<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Development and Programming Help. &#187; ASP.NET</title>
	<atom:link href="http://www.memo8.com/toolkits/archives/category/aspnet/feed" rel="self" type="application/rss+xml" />
	<link>http://www.memo8.com/toolkits</link>
	<description>Wep Programming-Mobile Programming-Windows Programming</description>
	<lastBuildDate>Wed, 01 Feb 2012 08:52:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>วิธีแก้ไข ASP.NET Error Exception Details: System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.</title>
		<link>http://www.memo8.com/toolkits/archives/503</link>
		<comments>http://www.memo8.com/toolkits/archives/503#comments</comments>
		<pubDate>Sun, 27 Jun 2010 07:39:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://www.memo8.com/toolkits/?p=503</guid>
		<description><![CDATA[ให้เพิ่ม MultipleActiveResultSets=true ใน ConnectionString
ตัวอย่าง
&#60;connectionStrings&#62;
  &#60;add  name="Default"
        connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=MyDb;Persist Security Info=True;User ID=sa;Password=sa;MultipleActiveResultSets=true"
        providerName="System.Data.SqlClient"/&#62;
&#60;/connectionStrings&#62;
ที่มา : http://blog.sb2.fr/post/2008/12/10/There-is-already-an-open-DataReader-associated-with-this-Command-which-must-be-closed-first.aspx
]]></description>
			<content:encoded><![CDATA[<p>ให้เพิ่ม <span><strong>MultipleActiveResultSets=true</strong> ใน </span>ConnectionString<span id="more-503"></span></p>
<p>ตัวอย่าง</p>
<pre class="code"><span>&lt;</span><span>connectionStrings</span><span>&gt;</span>
  <span>&lt;</span><span>add</span>  <span>name</span><span>="Default"</span>
        <span>connectionString</span><span>="Data Source=.\SQLEXPRESS;Initial Catalog=MyDb;Persist Security Info=True;User ID=sa;Password=sa;MultipleActiveResultSets=true"</span>
        <span>providerName</span><span>="System.Data.SqlClient"</span><span>/&gt;</span>
<span>&lt;/</span><span>connectionStrings</span><span>&gt;</span></pre>
<p>ที่มา : <a href="http://blog.sb2.fr/post/2008/12/10/There-is-already-an-open-DataReader-associated-with-this-Command-which-must-be-closed-first.aspx" target="_blank">http://blog.sb2.fr/post/2008/12/10/There-is-already-an-open-DataReader-associated-with-this-Command-which-must-be-closed-first.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.memo8.com/toolkits/archives/503/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>วิธีแก้ไข ASP.NET C# เมื่อ Rename หรือ Delete Folder แล้ว Session Timeout</title>
		<link>http://www.memo8.com/toolkits/archives/492</link>
		<comments>http://www.memo8.com/toolkits/archives/492#comments</comments>
		<pubDate>Thu, 24 Jun 2010 17:18:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://www.memo8.com/toolkits/?p=492</guid>
		<description><![CDATA[นั่งเสียเวลาเป็นชม.ๆ &#8211;&#8221; มันอะไรกันนักหนาเนี่ย 55+ ไปได้วิธีมาจากเว็บ Narisa และ Greatfriends ได้ความว่า ใน ASP.NET 2.0 ได้เพิ่มสิ่งที่เรียกว่า File Change Notifications (FCN) หรือ Directory Monitoring เพื่อคอยจับ Directory ทุกครั้งที่มีการ Rename หรือ Delete มันจะ Restart Application ดังนั้น Session State ที่เก็บแบบ InProc จะหายไปด้วย (เออเอากับมัน&#8230;)
เกริ่นซะยาวมาดูวิธีแก้กันเลยให้ใส่ Code ด้านล่างนี้ ในไฟล์ &#8220;Global.asax.cs&#8221; ที่ Events  Application_Start() และใช้ using System.Reflection ด้วย ซึ่งการทำงานของมันจะปิด Directory Monitoring ทันทีที่ Application เริ่มทำงาน
System.Reflection.PropertyInfo p [...]]]></description>
			<content:encoded><![CDATA[<p>นั่งเสียเวลาเป็นชม.ๆ &#8211;&#8221; มันอะไรกันนักหนาเนี่ย 55+ ไปได้วิธีมาจากเว็บ <a href="http://www.narisa.com/forums/index.php?showtopic=27585" target="_blank">Narisa</a> และ <a href="http://www.greatfriends.biz/webboards/msg.asp?id=106519">Greatfriends </a>ได้ความว่า ใน ASP.NET 2.0 ได้เพิ่มสิ่งที่เรียกว่า File Change Notifications (FCN) หรือ Directory Monitoring <span id="more-492"></span>เพื่อคอยจับ Directory ทุกครั้งที่มีการ Rename หรือ Delete มันจะ Restart Application ดังนั้น Session State ที่เก็บแบบ InProc จะหายไปด้วย (เออเอากับมัน&#8230;)</p>
<p><strong>เกริ่นซะยาวมาดูวิธีแก้กันเลยให้ใส่ Code ด้านล่างนี้ ในไฟล์ &#8220;Global.asax.cs&#8221; ที่ Events  Application_Start() และใช้ using System.Reflection ด้วย ซึ่งการทำงานของมันจะปิด Directory Monitoring ทันทีที่ Application เริ่มทำงาน</strong></p>
<pre class="code">System.Reflection.PropertyInfo p = typeof(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
object o = p.GetValue(null, null);
System.Reflection.FieldInfo f = o.GetType().GetField("_dirMonSubdirs", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.IgnoreCase);
object monitor = f.GetValue(o);
System.Reflection.MethodInfo m = monitor.GetType().GetMethod("StopMonitoring", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
m.Invoke(monitor, new object[] { });</pre>
<p><strong>สำหรับคนที่ยังไม่เคยใช้ Global.asax.cs ขออธิบายนิดนึงครับ</strong></p>
<p>ไฟล์ Global.asax.cs จะมีไฟล์ Global.asax Inherits มาเรียกอีกทีนึง และทั้งสองไฟล์จะต้องอยู่บนสุดของเว็บไซต์เท่านั้นนะจ๊ะ ยิ่งอธิบายยิ่ง&#8221;งง&#8221; ดาวน์โหลดไปเลยดีกว่าตรงนี้ผมใส่ Code ด้านบนไว้ให้เรียบร้อยแล้วครับ<a href="http://www.memo8.com/content/asp_net/asp-net-global.asax.rar" target="_blank"><br />
<strong>คลิกที่นี่เพื่อดาวน์โหลด Global.asax และ Global.asax.cs</strong></a></p>
<p>เมื่อเราใส่ Code เรียบร้อยแล้วหากเกิดกรณี Error ประมาณนี้</p>
<pre class="code"><span style="color: #800000;">
<strong>Security Exception</strong>
</span><span style="font-family: Arial,Helvetica,Geneva,SunSans-Regular,sans-serif;"><strong>Description: </strong>The application attempted to perform an  operation not allowed by the security policy.  To grant this  application the required permission please contact your system  administrator or change the application's trust level in the  configuration file.
<strong> Exception Details: </strong>System.Security.SecurityException:  Request failed.
<strong>Source Error:</strong></span>
<table border="0" width="100%" bgcolor="#ffffcc">
<tbody>
<tr>
<td><code> An unhandled exception was generated during the execution of the current  web request. Information regarding the origin and location of the  exception can be identified using the exception stack trace below.</code></td>
</tr>
</tbody>
</table>
</pre>
<p>ให้ไปที่ไฟล์ web.config แล้วไปเพิ่มตาม Code ด้านล่าง</p>
<pre class="code">&lt;system.web&gt;
<span style="color: #ff0000;">&lt;trust level="Full" originUrl=""/&gt;</span>
&lt;/system.web&gt;</pre>
<p>เป็นอันเสร็จเรียบร้อยครับ</p>
<p><strong>ที่มา :</strong><br />
<a href="http://www.narisa.com/forums/index.php?showtopic=27585" target="_blank">http://www.narisa.com/forums/index.php?showtopic=27585</a><br />
<a href="http://www.greatfriends.biz/webboards/msg.asp?id=106519" target="_blank">http://www.greatfriends.biz/webboards/msg.asp?id=106519</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.memo8.com/toolkits/archives/492/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>วิธีกำหนดตัวแปรในไฟล์ web.config ของ ASP.NET</title>
		<link>http://www.memo8.com/toolkits/archives/487</link>
		<comments>http://www.memo8.com/toolkits/archives/487#comments</comments>
		<pubDate>Thu, 17 Jun 2010 05:07:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP.NET (C#)]]></category>

		<guid isPermaLink="false">http://www.memo8.com/toolkits/?p=487</guid>
		<description><![CDATA[กำหนดตัวแปรในไฟล์ web.config
&#60;?xml version="1.0" encoding="UTF-8"?&#62;
&#60;configuration&#62;
.
.
.
&#60;appSettings&#62;
&#60;add key="cfgWebTitle" value="Memo8.com" /&#62;
&#60;/appSettings&#62;
&#60;/configuration&#62;
วิธีอ่านค่า (C#)
string cfgWebTitle=ConfigurationManager.AppSettings["cfgWebTitle"].ToString();
Response.Write(cfgWebTitle);
]]></description>
			<content:encoded><![CDATA[<p><strong>กำหนดตัวแปรในไฟล์ web.config<span id="more-487"></span></strong></p>
<pre class="code">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;configuration&gt;
.
.
.
&lt;appSettings&gt;
&lt;add key="cfgWebTitle" value="Memo8.com" /&gt;
&lt;/appSettings&gt;
&lt;/configuration&gt;</pre>
<p><strong>วิธีอ่านค่า (C#)</strong></p>
<pre class="code">string cfgWebTitle=ConfigurationManager.AppSettings["cfgWebTitle"].ToString();
Response.Write(cfgWebTitle);</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.memo8.com/toolkits/archives/487/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>เปิดไฟล์ Master Pages ของ ASP.NET ใน Dreamweaver 8 ให้สามารถ Design ได้</title>
		<link>http://www.memo8.com/toolkits/archives/484</link>
		<comments>http://www.memo8.com/toolkits/archives/484#comments</comments>
		<pubDate>Sat, 12 Jun 2010 15:36:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Tip]]></category>
		<category><![CDATA[Macromedia Dreamweaver 8]]></category>

		<guid isPermaLink="false">http://www.memo8.com/toolkits/?p=484</guid>
		<description><![CDATA[โดย Master Pages ของ ASP.NET นั้นจะเป็นนามสกุล master ซึ่ง Dreamweaver จะไม่รู้จัก ถ้าเรา Open With มาก็จะเป็น Text ไม่สามารถ Design ได้ วิธีที่จะทำให้ Dreamwever รู้จักไฟล์นามสกุล master อีกหนึ่งวิธีก็คือ

ให้เข้าไปที่ C:\Program Files\Macromedia\Dreamweaver 8\Configuration\DocumentTypes ถ้าเป็น Windows 64 bit ก็เปลี่ยนชื่อ Program Files ไปเป็น Program Files (x86)
หาไฟล์ชื่อ MMDocumentTypes.xml เปิดด้วยโปรแกรม text editor เพื่อแก้ไขไฟล์
เมื่อเปิดมาแล้วให้ค้นหา &#8220;ASP.NET_VB&#8221; และ &#8220;ASP.NET_CSharp&#8221;
หา attribute ที่ชื่อว่า &#8220;winfileextension&#8221; สังเกตุจะบรรจุค่าไว้ aspx,ascx,asmx ให้เราเพิ่ม master เข้าไป ดังนั้นจะได้เป็น winfileextension=&#8221;aspx,ascx,asmx,master&#8221;
ปิด [...]]]></description>
			<content:encoded><![CDATA[<p>โดย Master Pages ของ ASP.NET นั้นจะเป็นนามสกุล master ซึ่ง Dreamweaver จะไม่รู้จัก ถ้าเรา Open With มาก็จะเป็น Text ไม่สามารถ Design ได้ วิธีที่จะทำให้ Dreamwever รู้จักไฟล์นามสกุล master อีกหนึ่งวิธีก็คือ<span id="more-484"></span></p>
<ol>
<li>ให้เข้าไปที่ C:\Program Files\Macromedia\Dreamweaver 8\Configuration\DocumentTypes ถ้าเป็น Windows 64 bit ก็เปลี่ยนชื่อ Program Files ไปเป็น Program Files (x86)</li>
<li>หาไฟล์ชื่อ MMDocumentTypes.xml เปิดด้วยโปรแกรม text editor เพื่อแก้ไขไฟล์</li>
<li>เมื่อเปิดมาแล้วให้ค้นหา &#8220;ASP.NET_VB&#8221; และ &#8220;ASP.NET_CSharp&#8221;</li>
<li>หา attribute ที่ชื่อว่า &#8220;winfileextension&#8221; สังเกตุจะบรรจุค่าไว้ aspx,ascx,asmx ให้เราเพิ่ม master เข้าไป ดังนั้นจะได้เป็น<strong> winfileextension=&#8221;aspx,ascx,asmx,master&#8221;</strong></li>
<li>ปิด<strong> </strong>Dreamweaver แล้วเปิดใหม่ครับ เสร็จเรียบร้อยครับ</li>
</ol>
<p>&#8220;ไม่แน่ใจว่าเวอร์ชั่นอื่นจะแก้ด้วยวิธีนี้รึเปล่านะครับ แต่ผมคิดว่าพาธ config คงไม่ต่างกันมาก&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.memo8.com/toolkits/archives/484/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>วิธีแก้ไข ASP.NET Error : The SELECT permission was denied on the object &#8216;table_name&#8217;, database &#8216;table_name&#8217;, schema &#8216;dbo&#8217;.</title>
		<link>http://www.memo8.com/toolkits/archives/471</link>
		<comments>http://www.memo8.com/toolkits/archives/471#comments</comments>
		<pubDate>Thu, 10 Jun 2010 04:01:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MsSQL]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://www.memo8.com/toolkits/?p=471</guid>
		<description><![CDATA[จาก Error ตามหัวข้อเกิดจากไม่ได้ Add Permission (เพิ่งเคยเจอเหมือนกัน อุอุ) สามารถแก้ไขได้ดังนี้

เปิดโปรแกรม SQL Server Management Studio
ดูที่ Object Explorer (ด้านซ้าย)
เลือกโฟลเดอร์ &#62;&#62; Security &#62;&#62; Logins
เลือก User ที่ใช้งานอยู่ คลิกขวาเลือกเมนูลัด &#8220;Properties&#8221;
เมื่อขึ้นหน้าต่าง ดูที่ Select a page (ด้านซ้าย)
เลือก Server Role ให้ Check &#8220;sysadmin&#8221; กดปุ่ม Ok

เป็นอีกหนึ่งวิธีที่แก้ไข้ได้ครับ เรียบร้อยโรงเรียนไทย
]]></description>
			<content:encoded><![CDATA[<p>จาก Error ตามหัวข้อเกิดจากไม่ได้ Add Permission (เพิ่งเคยเจอเหมือนกัน อุอุ) สามารถแก้ไขได้ดังนี้<span id="more-471"></span></p>
<ol>
<li>เปิดโปรแกรม SQL Server Management Studio</li>
<li>ดูที่ Object Explorer (ด้านซ้าย)</li>
<li>เลือกโฟลเดอร์ &gt;&gt; Security &gt;&gt; Logins</li>
<li>เลือก User ที่ใช้งานอยู่ คลิกขวาเลือกเมนูลัด &#8220;Properties&#8221;</li>
<li>เมื่อขึ้นหน้าต่าง ดูที่ Select a page (ด้านซ้าย)</li>
<li>เลือก Server Role ให้ Check &#8220;sysadmin&#8221;<strong> </strong>กดปุ่ม Ok</li>
</ol>
<p>เป็นอีกหนึ่งวิธีที่แก้ไข้ได้ครับ เรียบร้อยโรงเรียนไทย</p>
]]></content:encoded>
			<wfw:commentRss>http://www.memo8.com/toolkits/archives/471/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ติดตั้ง IIS ไม่ได้ เพราะหาไฟล์ staxmem.dl_ ไม่เจอ</title>
		<link>http://www.memo8.com/toolkits/archives/92</link>
		<comments>http://www.memo8.com/toolkits/archives/92#comments</comments>
		<pubDate>Sun, 29 Jun 2008 18:00:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Tip]]></category>
		<category><![CDATA[IIS]]></category>

		<guid isPermaLink="false">http://www.memo8.com/toolkits/archives/92</guid>
		<description><![CDATA[ไม่ไ้ด้ติดตั้ง IIS มานานมาก พอมาติดตั้งกะไว้เขียน ASP.NET ก็เจอปัญหาตามหัวข้อ อะไรวะเนี่ย  Windows Pack2 เอากรุอีกแล้ว เลยไปเจอวิธีแก้ไขจากเว็บ  Support ของ microsoft โดยเป็น command prompt ซ่อมแซม Database Utility ที่มีปัญหา แต่ถ้าอยากรู้ละเอียดกว่านี้ก็แปลเอาเองละกันเด้อ ผมก็มีปัญญามั่วแค่นี้แหล่ะเหอๆ แต่ได้ผล วิธีการดังนี้จ่ะ
1. คลิก Start Menu &#62;&#62; Run &#62;&#62; พิมพ์ cmd
2. ให้พิมพ์คำสั่งตามด้านล่างนี้ แล้วเคาะ Enter
esentutl /p %windir%\security\database\secedit.sdb
3. จะมีหน้าต่าง  warningขึ้นมาให้กดปุ่ม OK
4. จากนั้นรอจนกว่าระบบจะ &#8220;Repair&#8221; เสร็จ
&#8220;ทีนี้ลองกลับไปติดตั้ง IIS ใหม่อีกครั้งครับ น่าจะได้แล้วล่ะ&#8221;
ที่มา : http://support.microsoft.com/kb/555268
]]></description>
			<content:encoded><![CDATA[<p>ไม่ไ้ด้ติดตั้ง IIS มานานมาก พอมาติดตั้งกะไว้เขียน ASP.NET ก็เจอปัญหาตามหัวข้อ อะไรวะเนี่ย  Windows Pack2 เอากรุอีกแล้ว <span id="more-92"></span>เลยไปเจอวิธีแก้ไขจากเว็บ  Support ของ microsoft โดยเป็น command prompt ซ่อมแซม Database Utility ที่มีปัญหา แต่ถ้าอยากรู้ละเอียดกว่านี้ก็แปลเอาเองละกันเด้อ ผมก็มีปัญญามั่วแค่นี้แหล่ะเหอๆ แต่ได้ผล วิธีการดังนี้จ่ะ</p>
<p>1. คลิก Start Menu &gt;&gt; Run &gt;&gt; พิมพ์ cmd<br />
2. ให้พิมพ์คำสั่งตามด้านล่างนี้ แล้วเคาะ Enter</p>
<pre class="code">esentutl /p %windir%\security\database\secedit.sdb</pre>
<p>3. จะมีหน้าต่าง  warningขึ้นมาให้กดปุ่ม OK<br />
4. จากนั้นรอจนกว่าระบบจะ &#8220;Repair&#8221; เสร็จ</p>
<p><strong>&#8220;ทีนี้ลองกลับไปติดตั้ง IIS ใหม่อีกครั้งครับ น่าจะได้แล้วล่ะ&#8221;</strong></p>
<p>ที่มา : <a href="http://" target="_blank">http://support.microsoft.com/kb/555268</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.memo8.com/toolkits/archives/92/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

