Thursday, December 11, 2008

app_offline.htm ใน asp.net 2.0

อีกหนึ่ง feature ที่เป็นสิ่งใหม่ใน asp.net 2.0 ก็คือการสร้าง file app_offline.htm ไปวางไว้ใน web root เพื่อทำการบอก user ของเราว่าเวบของเราตอนนี้กำลัง update อยู่framework 2.0จะทำความรู้จักfileนี้เองโดยอัตโนมัติโดยที่เราไม่ต้องทำอะไรเลย ง่ายต่อการนำไปใช้
ข้อที่ควรระวังก็คือ ใน IE6 ต้องไป config browser ตรง

Tools->Internet Options->Advanced tab ->"Show Friendly Http Errors Message"

ถ้าไม่เลือก option นี้เอาไว้เวลา user เข้าใช้จะแสดง error 404 แทน วิธีที่แก้ใขโดยที่ user ไม่ต้องเลือกตรง Option นี้ก็คือการสร้าง app_offline.htm ให้มีขนาด file มากกว่า 512 byte เพื่อให้แน่ใจว่า user ทุกคนเข้าเวบเรามาแล้วแสดงหน้านี้ตลอด หาก file app_offline.htm ของเรามีไม่ถึง 512 byte อาจใช้วิธีการใส่ comment ลงไปเพื่อให้ file มีขนาดเกิน 512 byte ดังตัวอย่างด้านล่าง


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> My Under ConStruction</TITLE>
</HEAD>
<BODY>
<h1>This Site Under Construction N o w !...</h1>
<!--
this coment text
<h1>This Site Under Construction N o w !...</h1>
<h1>This Site Under Construction N o w !...</h1>
<h1>This Site Under Construction N o w !...</h1>
<h1>This Site Under Construction N o w !...</h1>
<h1>This Site Under Construction N o w !...</h1>
<h1>This Site Under Construction N o w !...</h1>
<h1>This Site Under Construction N o w !...</h1>
<h1>This Site Under Construction N o w !...</h1>
<h1>This Site Under Construction N o w !...</h1>
<h1>This Site Under Construction N o w !...</h1>
-->
</BODY>
</HTML>


ที่มา: http://codesnippet.exteen.com/20060628/app-offline-htm-asp-net-2-0

Thursday, November 6, 2008

An ASP.NET setting has been detected that does not apply in the Integrated managed pipeline mode



จะเจอ error นี้เมื่อสร้าง application หรือ vertual directory ใหม่แล้วเข้าใช้เว็บไซต์ (IIS7)

แก้โดยกด “Windows” + “R” แล้วพิมพ์ %SystemRoot%\system32\inetsrv\appcmd migrate config "Default Web Site/" กด OK เป็นอันเสร็จ

ลอง refresh หน้าจอใหม่ก็จะ run application ได้

http://blog.benhall.me.uk/2008/05/aspnet-setting-has-been-detected-that.html
http://www.monavista.com/webboard/showthread.php?t=4839

Thursday, October 2, 2008

Visual Studio 2008 Error

SOFTWARE:
Visual Studio 2008 Team Database Edition
SQL Server 2005 Enterprise SP2

ERRORS:
"The database that you selected is not supported"

Unable to add data connection.
Could not load file or assembly
'Microsoft.SQLServer.Management.Sdk.Sfc, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its
dependencies. The sytem cannot find the file specified.

STEPS TO REPRODUCE:
Data > Schema Compare
New Connection..
Type in all info > select database name (it IS seeing all the
databases on the server)
click Test Connection
"Test Connection suceeded"
Click OK
"The database that you selected is not supported"

Does the same thing if I do
New Project > Visual C# > Database > SQL Server Project
Server Explorer
Add New Connection
Error:
Unable to add data connection.
Could not load file or assembly
'Microsoft.SQLServer.Management.Sdk.Sfc, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its
dependencies. The sytem cannot find the file specified.

TROUBLESHOOTING STEPS ALREADY TAKEN:
I tried totally uninstalling Visual Studio 2008, 2005, and SQL 2005
Workstation Components/Client Tools..
Installed Visual Studio 2008
Tried same thing, got same error message.
Installed SQL 2005 Workstation Components / Client Tools
Installed SQL 2005 SP2
Tried same thing, got same error message.

SOLUTION: Download and install following from Microsoft.

- Microsoft SQL Server 2008 Native Client
- Microsoft SQL Server System CLR Types
- Microsoft SQL Server 2008 Management Objects

These features can be downloaded from:
http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&displaylang=en#filelist

Reference: http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.vstudio.general&tid=89ee0e86-b8fc-40a7-a0e1-51ac4033302e&cat=en_US_38f7e3d1-40bd-4daf-941f-f45d2ff6ff9b&lang=en&cr=US&sloc=&p=1

Monday, September 29, 2008

Run SQL Server 2000 DTS by Stored Procedure

1. “Windows” + “R” พิมพ์ dtsrunui ในช่อง Open แล้วกด OK



2. จะมีหน้าจอตามรูปด้านล่าง ใส่ ip server ในช่อง Server แล้วก็ใส่ Username และ Password ของ Server นั้น หลังจากนั้นกดปุ่ม ... หลังช่อง Package name จะมี list ของ DTS ใน Server นั้นมาให้เราเลือก เลือก DTS ที่ต้องการ แล้วกด OK



3. จากรูปในขั้นตอนที่แล้ว กดปุ่ม Advanced... จะได้หน้าจอตามรูปด้านล่าง กดปุ่ม Generate... จะมี command ขึ้นมาในช่องด้านหน้า ถ้าต้องการ Encrypt command เพื่อไม่ให้เห็น username และ password ให้ติ๊กถูกที่ Encrypt the command แล้วกด Generate อีกรอบ จะได้ command ที่ encrypt ไว้



4. หลังจากนั้นเอา command ที่ได้ มารันเหมือน SQL ปกติตาม code ด้านล่างนี้

EXEC master..xp_cmdshell {'command_string'}

http://msdn.microsoft.com/en-us/library/aa260689(SQL.80).aspx