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

<channel>
	<title>oue&#039;s profile &#187; ASP.NET</title>
	<atom:link href="http://www.aspgod.com/category/aspnet/feed" rel="self" type="application/rss+xml" />
	<link>http://www.aspgod.com</link>
	<description>AI algorithm graphics programming blog Firefox ff</description>
	<lastBuildDate>Fri, 20 Jan 2012 16:59:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>OnClientClick with Validation in ASP.Net</title>
		<link>http://www.aspgod.com/aspnet/onclientclick-with-validation-in-asp-net.html</link>
		<comments>http://www.aspgod.com/aspnet/onclientclick-with-validation-in-asp-net.html#comments</comments>
		<pubDate>Fri, 26 Mar 2010 06:30:11 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[confirm]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[OnClientClick]]></category>
		<category><![CDATA[Page_ClientValidate]]></category>
		<category><![CDATA[Validation]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/?p=491</guid>
		<description><![CDATA[เมื่อ input ต้องการ validate รวมถึงการ confirm พร้อมๆกันจะทำอย่างไร ในเมื่อการใส่อย่างใดอย่างหนึ่งก็สามารถทำงานได้ในตัวของมันเอง แต่หากนำมันมารวมกัน ก็จะพบว่าการ validate input นั้นไม่ทำงาน มีวิธีการแก้ไข 2 วิธี 1. ให้ alert confirm input ก่อน แล้วค่อยทำการ validate วิธีนี้ต้องใส่โค๊ดด้านล่างไว้ที่ Page_Load btnSubmit.Attributes.Add&#40;&#34;onclick&#34;, &#34;if(confirm('do this ?') == false) return false;&#34;&#41;; 2. ให้ validate ก่อน แล้วค่อย alert confirm input ให้ใส่โค๊ดนี้ในส่วนของ asp:Button OnClientClick=&#34;if (Page_ClientValidate('vd1')){return confirm('Are you sure you want to perform this action?')}&#34; [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.aspgod.com/wp-content/uploads/2010/03/26-3-2553-13-10-12.png"><img class="aligncenter size-full wp-image-492" title="OnClientClick with Validation in ASP.Net" src="http://www.aspgod.com/wp-content/uploads/2010/03/26-3-2553-13-10-12.png" alt="OnClientClick with Validation on ASP.Net" width="297" height="66" /></a></p>
<p>เมื่อ input ต้องการ validate รวมถึงการ confirm พร้อมๆกันจะทำอย่างไร ในเมื่อการใส่อย่างใดอย่างหนึ่งก็สามารถทำงานได้ในตัวของมันเอง แต่หากนำมันมารวมกัน ก็จะพบว่าการ validate input นั้นไม่ทำงาน</p>
<p><a href="http://www.aspgod.com/wp-content/uploads/2010/03/26-3-2553-13-18-00.png"><img class="aligncenter size-full wp-image-493" title="OnClientClick with Validation in ASP.Net" src="http://www.aspgod.com/wp-content/uploads/2010/03/26-3-2553-13-18-00.png" alt="OnClientClick with Validation in ASP.Net" width="580" height="50" /></a></p>
<p><strong>มีวิธีการแก้ไข 2 วิธี</strong><br />
1. ให้ alert confirm input ก่อน แล้วค่อยทำการ validate วิธีนี้ต้องใส่โค๊ดด้านล่างไว้ที่ Page_Load</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">btnSubmit.<span style="color: #660066;">Attributes</span>.<span style="color: #660066;">Add</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;onclick&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;if(confirm('do this ?') == false) return false;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>2. ให้ validate ก่อน แล้วค่อย alert confirm input ให้ใส่โค๊ดนี้ในส่วนของ asp:Button</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">OnClientClick<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;if (Page_ClientValidate('vd1')){return confirm('Are you sure you want to perform this action?')}&quot;</span></pre></div></div>

<p><a href="http://www.aspgod.com/wp-content/uploads/2010/03/26-3-2553-14-26-54.png"><img class="aligncenter size-full wp-image-503" title="OnClientClick with Validation in ASP.Net" src="http://www.aspgod.com/wp-content/uploads/2010/03/26-3-2553-14-26-54.png" alt="OnClientClick with Validation in ASP.Net" width="561" height="76" /></a><br />
สำหรับ page ไหนที่มี ValidationGroup หลายตัว ให้ใส่ชื่อ group นั้นใน Page_ClientValidate(&#8216;&#8230;.&#8217;) ด้วย แต่ถ้ามี group เดียวก็ปล่อยว่างได้ครับ<br />
สามารถอธิบายในส่วน if (Page_ClientValidate()) ได้ว่า ถ้าผ่านการ validate เรียบร้อยแล้ว จะทำงานในส่วนของภายใน if ดังนั้นถ้า validate ไม่ผ่าน ก็จะไม่เกิดอะไรขึ้นในส่วนนี้ครับ</p>
<p>ขอบคุณ<br />
<a href="http://msdotnetsupport.blogspot.com/2008/09/onclientclick-and-form-validation-in.html" target="_blank">msdotnetsupport</a><br />
<a href="http://www.stevekinsey.com/2007/06/04/onclientclick-and-form-validation-controls/" target="_blank">stevekinsey</a></p>
<p><span style="color: #800000;"><strong>หวังว่าข้อมูลนี้จะเป็นประโยชน์ไม่มากก็น้อยนะครับ</strong></span></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/aspnet/onclientclick-with-validation-in-asp-net.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Method Post on Code Behide with asp.net (แก้ปัญหาภาษาไทย)</title>
		<link>http://www.aspgod.com/aspnet/method-post-on-code-behide-with-asp-net-%e0%b9%81%e0%b8%81%e0%b9%89%e0%b8%9b%e0%b8%b1%e0%b8%8d%e0%b8%ab%e0%b8%b2%e0%b8%a0%e0%b8%b2%e0%b8%a9%e0%b8%b2%e0%b9%84%e0%b8%97%e0%b8%a2.html</link>
		<comments>http://www.aspgod.com/aspnet/method-post-on-code-behide-with-asp-net-%e0%b9%81%e0%b8%81%e0%b9%89%e0%b8%9b%e0%b8%b1%e0%b8%8d%e0%b8%ab%e0%b8%b2%e0%b8%a0%e0%b8%b2%e0%b8%a9%e0%b8%b2%e0%b9%84%e0%b8%97%e0%b8%a2.html#comments</comments>
		<pubDate>Sun, 14 Mar 2010 11:09:33 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[encode]]></category>
		<category><![CDATA[method post]]></category>
		<category><![CDATA[WebClient]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/?p=456</guid>
		<description><![CDATA[จากเนื้อหาเก่า Method Post on Code Behide with asp.net มีปัญหาในการส่งข้อมูลประเภทภาษาไทย ดังนั้นในส่วนของการ encode ให้ทำแบบนี้ วิธีนี้ได้มาจาก krucode.net ครับ 1 2 System.Text.Encoding encoder= System.Text.Encoding.GetEncoding&#40;65001&#41;; byte&#91;&#93; byteData = encoder.GetBytes&#40;outputBuffer&#41;; เมื่อเอามารวมกันเต็มๆก็จะเป็นแบบโค๊ดด้านล่างครับ 1 2 3 4 5 6 7 8 9 10 11 12 13 string responseString = &#34;&#34;; string outputBuffer = string.Format&#40;&#34;msg={0}&#38;senderemail={1}&#38;sendername={2}&#38;tel={3}&#34;,mail.Msg, mail.SenderEmail, mail.SenderName, mail.Tel&#41;; WebClient postWebClient = new WebClient&#40;&#41;; postWebClient.Headers.Add&#40;&#34;Content-Type&#34;, [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>จากเนื้อหาเก่า <a href="http://www.aspgod.com/aspnet/method-post-on-code-behide-with-asp-net.html">Method Post on Code Behide with asp.net</a> มีปัญหาในการส่งข้อมูลประเภทภาษาไทย ดังนั้นในส่วนของการ encode ให้ทำแบบนี้ วิธีนี้ได้มาจาก <a href="http://krucode.net/">krucode.net</a> ครับ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #000000;">System.<span style="color: #0000FF;">Text</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Encoding</span> encoder<span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Text</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Encoding</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetEncoding</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">65001</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> byteData <span style="color: #008000;">=</span> encoder<span style="color: #008000;">.</span><span style="color: #0000FF;">GetBytes</span><span style="color: #008000;">&#40;</span>outputBuffer<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>เมื่อเอามารวมกันเต็มๆก็จะเป็นแบบโค๊ดด้านล่างครับ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">string</span> responseString <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
<span style="color: #6666cc; font-weight: bold;">string</span> outputBuffer <span style="color: #008000;">=</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;msg={0}&amp;senderemail={1}&amp;sendername={2}&amp;tel={3}&quot;</span>,mail<span style="color: #008000;">.</span><span style="color: #0000FF;">Msg</span>, mail<span style="color: #008000;">.</span><span style="color: #0000FF;">SenderEmail</span>, mail<span style="color: #008000;">.</span><span style="color: #0000FF;">SenderName</span>, mail<span style="color: #008000;">.</span><span style="color: #0000FF;">Tel</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
WebClient postWebClient <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> WebClient<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
postWebClient<span style="color: #008000;">.</span><span style="color: #0000FF;">Headers</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Content-Type&quot;</span>, <span style="color: #666666;">&quot;application/x-www-form-urlencoded&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #6666cc; font-weight: bold;">string</span> postUrl <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;http://localhost:53680/aspgod/contact_receive.aspx&quot;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// encode</span>
<span style="color: #000000;">System.<span style="color: #0000FF;">Text</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Encoding</span> encoder<span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Text</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Encoding</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetEncoding</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">65001</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> byteData <span style="color: #008000;">=</span> encoder<span style="color: #008000;">.</span><span style="color: #0000FF;">GetBytes</span><span style="color: #008000;">&#40;</span>outputBuffer<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> responseArray <span style="color: #008000;">=</span> postWebClient<span style="color: #008000;">.</span><span style="color: #0000FF;">UploadData</span><span style="color: #008000;">&#40;</span>postUrl, <span style="color: #666666;">&quot;POST&quot;</span>, byteData<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
responseString <span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Text</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Encoding</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ASCII</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetString</span><span style="color: #008000;">&#40;</span>responseArray<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>responseString<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>สำหรับคนที่ส่งสัยว่าทำไมต้องเป็นเลข 65001 ให้ตามมาดูที่ <a href="http://www.pcreview.co.uk/forums/thread-1406242.php">System.Text.Encoding.GetEncoding(WhatValidStrings)</a> ได้เลยครับ</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/aspnet/method-post-on-code-behide-with-asp-net-%e0%b9%81%e0%b8%81%e0%b9%89%e0%b8%9b%e0%b8%b1%e0%b8%8d%e0%b8%ab%e0%b8%b2%e0%b8%a0%e0%b8%b2%e0%b8%a9%e0%b8%b2%e0%b9%84%e0%b8%97%e0%b8%a2.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Method Post on Code Behide with asp.net</title>
		<link>http://www.aspgod.com/aspnet/method-post-on-code-behide-with-asp-net.html</link>
		<comments>http://www.aspgod.com/aspnet/method-post-on-code-behide-with-asp-net.html#comments</comments>
		<pubDate>Thu, 11 Mar 2010 04:25:43 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[method post]]></category>
		<category><![CDATA[WebClient]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/?p=439</guid>
		<description><![CDATA[การส่งข้อมูลระหว่าง page สามารถทำได้ 2 วิธี 1. get method 2. post method สำหรับแบบ get ใครๆก็ทำได้ แค่เรียก url แล้วใส่ parameter ตามหลังไป เช่น www.aspgod.com/view.aspx?id=30 กรณีนี้อาจไม่ปลอดภัยเพราะแค่เปลี่ยน parameter ก็สามารถเข้าถึงหน้าต่างๆได้ หากเราต้องการความปลอดภัยของข้อมูลที่มากกว่านี้ แนะนำให้ใช้ method post การส่งแบบ post โดยปกติในรูปแบบของ html ก็สามารถทำได้ง่ายแค่เปลี่ยนหัวของ form แต่หากเป็น aspx และเราต้องการนำข้อมูลนั้นๆมาประมวลผลก่อนแล้วค่อยส่งไปหน้าอื่นๆ เราต้องทำผ่าน code behide แล้วค่อยส่งข้อมูลไปยังหน้าอื่นโดยใช้ WebClient เข้ามาช่วย ตามตัวอย่างข้างล่างเลยครับ 1 2 3 4 5 6 7 8 9 10 string [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>การส่งข้อมูลระหว่าง page สามารถทำได้ 2 วิธี</p>
<p>1. get method</p>
<p>2. post method</p>
<p>สำหรับแบบ get ใครๆก็ทำได้ แค่เรียก url แล้วใส่ parameter ตามหลังไป เช่น www.aspgod.com/view.aspx?id=30 กรณีนี้อาจไม่ปลอดภัยเพราะแค่เปลี่ยน parameter ก็สามารถเข้าถึงหน้าต่างๆได้ หากเราต้องการความปลอดภัยของข้อมูลที่มากกว่านี้ แนะนำให้ใช้ method post</p>
<p>การส่งแบบ post โดยปกติในรูปแบบของ html ก็สามารถทำได้ง่ายแค่เปลี่ยนหัวของ form แต่หากเป็น aspx และเราต้องการนำข้อมูลนั้นๆมาประมวลผลก่อนแล้วค่อยส่งไปหน้าอื่นๆ เราต้องทำผ่าน code behide แล้วค่อยส่งข้อมูลไปยังหน้าอื่นโดยใช้ WebClient เข้ามาช่วย ตามตัวอย่างข้างล่างเลยครับ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">string</span> responseString <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
<span style="color: #6666cc; font-weight: bold;">string</span> outputBuffer <span style="color: #008000;">=</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;msg={0}&amp;senderemail={1}&amp;sendername={2}&amp;tel={3}&quot;</span>,mail<span style="color: #008000;">.</span><span style="color: #0000FF;">Msg</span>, mail<span style="color: #008000;">.</span><span style="color: #0000FF;">SenderEmail</span>, mail<span style="color: #008000;">.</span><span style="color: #0000FF;">SenderName</span>, mail<span style="color: #008000;">.</span><span style="color: #0000FF;">Tel</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
WebClient postWebClient <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> WebClient<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
postWebClient<span style="color: #008000;">.</span><span style="color: #0000FF;">Headers</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Content-Type&quot;</span>, <span style="color: #666666;">&quot;application/x-www-form-urlencoded&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #6666cc; font-weight: bold;">string</span> postUrl <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;http://localhost:53680/aspgod/contact_receive.aspx&quot;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> byteData <span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Text</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Encoding</span><span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Default</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetBytes</span><span style="color: #008000;">&#40;</span>outputBuffer<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> responseArray <span style="color: #008000;">=</span> postWebClient<span style="color: #008000;">.</span><span style="color: #0000FF;">UploadData</span><span style="color: #008000;">&#40;</span>postUrl, <span style="color: #666666;">&quot;POST&quot;</span>, byteData<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
responseString <span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Text</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Encoding</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ASCII</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetString</span><span style="color: #008000;">&#40;</span>responseArray<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>responseString<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>เป็นระบบส่ง mail โดยการส่งไปให้หน้า contact_receive.aspx เป็นผู้ส่งเมลล์ให้ หากส่งสำเร็จก็จะ Response.Write(&#8220;success&#8221;); กลับมา ทำให้เราตรวจสอบได้ว่าถูกต้องหรือไม่ หากทำตามตัวอย่างนี้ก็สามารถส่งข้อมูลผ่าน method post ด้วย code behide ได้ครับ</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/aspnet/method-post-on-code-behide-with-asp-net.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>javascript escape() encode url ภาษาไทย</title>
		<link>http://www.aspgod.com/aspnet/javascript-escape-encode-url-%e0%b8%a0%e0%b8%b2%e0%b8%a9%e0%b8%b2%e0%b9%84%e0%b8%97%e0%b8%a2.html</link>
		<comments>http://www.aspgod.com/aspnet/javascript-escape-encode-url-%e0%b8%a0%e0%b8%b2%e0%b8%a9%e0%b8%b2%e0%b9%84%e0%b8%97%e0%b8%a2.html#comments</comments>
		<pubDate>Fri, 25 Dec 2009 09:01:14 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[encode]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/?p=399</guid>
		<description><![CDATA[นานๆจะได้ลองเล่น Ajax ดู ก็เลยเกิดปัญหาที่ต้องส่งข้อมูลจาก javascript ไปยัง page อื่นเพื่อประมวลผล จริงๆจะไม่ใช้ Ajax ก็ได้ครับ แต่อารมณ์นั้นมันอยากลองของน่ะ เอาวิธีการใช้งาน Ajax จาก inoomzaa มาเล่นดูอ่ะ คือมันก็ใช้งานได้ดีกว่า .net 2.0 แต่มามีปัญหากับ .net 1.1 คงเพราะเป็น default encoding แหละครับ แก้ไปทุกกระบวนท่าใน page ขารับแล้วก็ไม่ได้ซักครั้ง จึงต้องใช้ท่าไม้ตาย เดินไปถามหัวหน้า(พี่ตู้) จึงได้คำตอบมาว่าให้ใส่ escape() ครอบข้อมูลในขาส่งไปยัง page ด้วย เพื่อ encode ก่อน เพราะภาษาไทยมีปัญหาเรื่องนี้ตลอดเลย ใช่ว่าจะหาคำตอบได้ง่ายๆ คนไทยเวลาพบปัญหาก็ไม่โพสวิธีการแก้ปัญหา พอไปหาเว็บนอก มันก็ไม่เจอปัญหาแบบที่คนไทยเจออีก เพราะของเค้าเป็นภาษาอังกฤษ ลองดูตัวอย่างโค๊ดนะครับ 1 2 // นี่เป็น javascript ในขาส่งครับ xmlHttp.open&#40;&#34;get&#34;,&#34;http://localhost/WEB/UtilPage/ResponseManualMsg.aspx?msg=&#34;+escape&#40;Criteria.value&#41;,true&#41;; // [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>นานๆจะได้ลองเล่น Ajax ดู ก็เลยเกิดปัญหาที่ต้องส่งข้อมูลจาก javascript ไปยัง page อื่นเพื่อประมวลผล จริงๆจะไม่ใช้ Ajax ก็ได้ครับ แต่อารมณ์นั้นมันอยากลองของน่ะ เอาวิธีการใช้งาน Ajax จาก <a href="http://krucode.net">inoomzaa</a> มาเล่นดูอ่ะ คือมันก็ใช้งานได้ดีกว่า .net 2.0 แต่มามีปัญหากับ .net 1.1 คงเพราะเป็น default encoding แหละครับ แก้ไปทุกกระบวนท่าใน page ขารับแล้วก็ไม่ได้ซักครั้ง จึงต้องใช้ท่าไม้ตาย เดินไปถามหัวหน้า(พี่ตู้) จึงได้คำตอบมาว่าให้ใส่ escape() ครอบข้อมูลในขาส่งไปยัง page ด้วย เพื่อ encode ก่อน เพราะภาษาไทยมีปัญหาเรื่องนี้ตลอดเลย ใช่ว่าจะหาคำตอบได้ง่ายๆ คนไทยเวลาพบปัญหาก็ไม่โพสวิธีการแก้ปัญหา พอไปหาเว็บนอก มันก็ไม่เจอปัญหาแบบที่คนไทยเจออีก เพราะของเค้าเป็นภาษาอังกฤษ ลองดูตัวอย่างโค๊ดนะครับ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// นี่เป็น javascript ในขาส่งครับ</span>
xmlHttp<span style="color: #008000;">.</span><span style="color: #0000FF;">open</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;get&quot;</span>,<span style="color: #666666;">&quot;http://localhost/WEB/UtilPage/ResponseManualMsg.aspx?msg=&quot;</span><span style="color: #008000;">+</span>escape<span style="color: #008000;">&#40;</span>Criteria<span style="color: #008000;">.</span><span style="color: #0000FF;">value</span><span style="color: #008000;">&#41;</span>,<span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// ใช้ escape เข้าช่วย</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// ส่วนนี่เป็นหน้า .aspx ในขารับ ธรรมดามากมาย</span>
Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>Request<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;msg&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// ไม่ต้องแปลงอะไรเลย</span></pre></td></tr></table></div>

<p>เสร็จสมบูรณ์อย่างสวยงาม เสียเวลาไปตั้ง 2 วันแน่ะ ไว้วันหลังจะหาวิธีการใช้ ajax ที่ดีกว่านี้มาให้ดูนะครับ</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/aspnet/javascript-escape-encode-url-%e0%b8%a0%e0%b8%b2%e0%b8%a9%e0%b8%b2%e0%b9%84%e0%b8%97%e0%b8%a2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>string.IndexOf and string.SubString example code</title>
		<link>http://www.aspgod.com/aspnet/string-indexof-and-string-substring-example-code.html</link>
		<comments>http://www.aspgod.com/aspnet/string-indexof-and-string-substring-example-code.html#comments</comments>
		<pubDate>Mon, 14 Dec 2009 13:16:02 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[IndexOf]]></category>
		<category><![CDATA[SubString]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/?p=395</guid>
		<description><![CDATA[เอาตัวอย่างการใช้งาน IndexOf กับ SubString มาให้ดูกันอีกซักตัวอย่าง โดย code ตัวนี้เอาไว้แยก string ออกเป็น 2 ตัวด้วย &#8220;&#124;&#124;&#8221; วิธีปกติผมจะ Replace &#124;&#124; ด้วย &#124; จากนั้นค่อย SubString ด้วยตัว &#124; อีกครั้ง ซึ่งก็ได้ผลลัพธ์ที่ถูกต้องเช่นกัน แต่นี่ก็เป็นอีกวิธีหนึ่งครับ เป็นการดูว่าตัว &#124;&#124; อยู่ในตำแหน่งไหนของ string แล้วค่อยแยก string ออกเป็น 2 ตัวด้วยตำแหน่งของ &#124;&#124; ครับ ลองดูตัวอย่าง น่าจะเข้าใจนะครับ 1 2 3 4 5 6 7 8 9 10 11 12 string body = &#34;1234&#124;&#124;http://www.aspgod.com&#34;; &#160; [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>เอาตัวอย่างการใช้งาน IndexOf กับ SubString มาให้ดูกันอีกซักตัวอย่าง โดย code ตัวนี้เอาไว้แยก string ออกเป็น 2 ตัวด้วย &#8220;||&#8221; วิธีปกติผมจะ Replace || ด้วย | จากนั้นค่อย SubString ด้วยตัว | อีกครั้ง ซึ่งก็ได้ผลลัพธ์ที่ถูกต้องเช่นกัน แต่นี่ก็เป็นอีกวิธีหนึ่งครับ เป็นการดูว่าตัว || อยู่ในตำแหน่งไหนของ string แล้วค่อยแยก string ออกเป็น 2 ตัวด้วยตำแหน่งของ || ครับ ลองดูตัวอย่าง น่าจะเข้าใจนะครับ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">string</span> body <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;1234||http://www.aspgod.com&quot;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #6666cc; font-weight: bold;">int</span> indexSub <span style="color: #008000;">=</span> body<span style="color: #008000;">.</span><span style="color: #0000FF;">IndexOf</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;||&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>indexSub <span style="color: #008000;">!=</span> <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #6666cc; font-weight: bold;">string</span> msg <span style="color: #008000;">=</span> body<span style="color: #008000;">.</span><span style="color: #0000FF;">Substring</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span>, indexSub<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #6666cc; font-weight: bold;">string</span> url <span style="color: #008000;">=</span> body<span style="color: #008000;">.</span><span style="color: #0000FF;">Substring</span><span style="color: #008000;">&#40;</span>indexSub <span style="color: #008000;">+</span> <span style="color: #FF0000;">2</span>, body<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">-</span> indexSub <span style="color: #008000;">-</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>indexSub <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&lt;br/&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// 4</span>
    Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>msg <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&lt;br/&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// 1234</span>
    Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>url <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&lt;br/&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// http://www.aspgod.com</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>ผม write ผลลัพธ์ออกมา 3 ตัว<br />
1. ตำแหน่งของ ||<br />
2. string ชุดแรกที่ตัดออกมา<br />
3. string ชุดสองที่ตัดออกมา</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/aspnet/string-indexof-and-string-substring-example-code.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Web Service Access Denied on localhost</title>
		<link>http://www.aspgod.com/aspnet/web-service-access-denied-on-localhost.html</link>
		<comments>http://www.aspgod.com/aspnet/web-service-access-denied-on-localhost.html#comments</comments>
		<pubDate>Tue, 03 Nov 2009 07:42:12 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Access Denied]]></category>
		<category><![CDATA[Anonymous Access]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/myprofile/?p=377</guid>
		<description><![CDATA[ผมพบปัญหานี้เมื่อใช้ .NET Framework 1.1 เป็น web service และใช้ app จากในเครื่องเดียวกันในการเรียกใช้ web service นั้น ได้รับ error เป็น 401 access denied วิธีแก้ไขอาจมีหลายวิธีก็ได้ครับ แต่ผมพบวิธีแก้ปัญหาแล้วนั่นคือ เข้าไป set ที่ IIS แล้วปรับในส่วนของ Authentication Methods ให้เป็น Anonymous Access ครับ เท่านี้ก็จะสามารถเข้ามาใช้งาน web service ในเครื่องตัวเองได้ No related posts. Related posts brought to you by Yet Another Related Posts Plugin.
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>ผมพบปัญหานี้เมื่อใช้ .NET Framework 1.1 เป็น web service และใช้ app จากในเครื่องเดียวกันในการเรียกใช้ web service นั้น ได้รับ error เป็น 401 access denied วิธีแก้ไขอาจมีหลายวิธีก็ได้ครับ แต่ผมพบวิธีแก้ปัญหาแล้วนั่นคือ เข้าไป set ที่ IIS แล้วปรับในส่วนของ Authentication Methods ให้เป็น Anonymous Access ครับ เท่านี้ก็จะสามารถเข้ามาใช้งาน web service ในเครื่องตัวเองได้<br />
<img src="http://www.aspgod.com/myprofile/wp-content/uploads/2009/11/401accessDenied.JPG" alt="IIS Setting Anonymous Access" /></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/aspnet/web-service-access-denied-on-localhost.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use string.SubString in .NET</title>
		<link>http://www.aspgod.com/aspnet/how-to-use-string-substring-in-net.html</link>
		<comments>http://www.aspgod.com/aspnet/how-to-use-string-substring-in-net.html#comments</comments>
		<pubDate>Wed, 28 Oct 2009 08:45:21 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[SubString]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/myprofile/?p=372</guid>
		<description><![CDATA[มีตัวอย่างการใช้ SubString ของ .NET มาให้ดูครับ จริงๆแล้วมันก็ไม่ได้ยากอะไรหรอก เพียงแต่หลายๆคนอาจจะสับสนว่าต้องใช้ parameter อะไรบ้าง และใช้อย่างไร นี่เป็นตัวอย่างเล็กๆที่น่าจะทำให้ทุกคนเข้าใจได้ อย่าประหลาดใจล่ะ ว่าทำไมผมถึงให้ตัวแปรมีค่าเป็นแบบนั้น แบบว่าทำงานเกี่ยวกับ mobile ก็เอาซะหน่อย คงไม่ต้องอธิบายอะไรกันมากมายนะครับ ดูผลลัพธ์แล้วน่าจะเข้าใจกันทุกคน โชคดีครับผม มีอะไรก็ถามละกัน ^ ^ 1 2 3 4 5 string shortcode = &#34;388805301&#34;; Response.Write&#40;shortcode.Substring&#40;0,7&#41; + &#34;&#60;br/&#62;&#34;&#41;; // result : 3888053 Response.Write&#40;shortcode.Substring&#40;7, 2&#41; + &#34;&#60;br/&#62;&#34;&#41;; // result : 01 Response.Write&#40;shortcode.Substring&#40;2&#41; + &#34;&#60;br/&#62;&#34;&#41;; // result : 8805301 Response.Write&#40;shortcode.Substring&#40;7&#41; + [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>มีตัวอย่างการใช้ SubString ของ .NET มาให้ดูครับ จริงๆแล้วมันก็ไม่ได้ยากอะไรหรอก เพียงแต่หลายๆคนอาจจะสับสนว่าต้องใช้ parameter อะไรบ้าง และใช้อย่างไร</p>
<p>นี่เป็นตัวอย่างเล็กๆที่น่าจะทำให้ทุกคนเข้าใจได้ อย่าประหลาดใจล่ะ ว่าทำไมผมถึงให้ตัวแปรมีค่าเป็นแบบนั้น แบบว่าทำงานเกี่ยวกับ mobile ก็เอาซะหน่อย <img src='http://www.aspgod.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  คงไม่ต้องอธิบายอะไรกันมากมายนะครับ ดูผลลัพธ์แล้วน่าจะเข้าใจกันทุกคน</p>
<p>โชคดีครับผม<br />
มีอะไรก็ถามละกัน ^ ^</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">string</span> shortcode <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;388805301&quot;</span><span style="color: #008000;">;</span>
Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>shortcode<span style="color: #008000;">.</span><span style="color: #0000FF;">Substring</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span>,<span style="color: #FF0000;">7</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&lt;br/&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>     <span style="color: #008080; font-style: italic;">// result : 3888053</span>
Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>shortcode<span style="color: #008000;">.</span><span style="color: #0000FF;">Substring</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">7</span>, <span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&lt;br/&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>    <span style="color: #008080; font-style: italic;">// result : 01</span>
Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>shortcode<span style="color: #008000;">.</span><span style="color: #0000FF;">Substring</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&lt;br/&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>       <span style="color: #008080; font-style: italic;">// result : 8805301</span>
Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>shortcode<span style="color: #008000;">.</span><span style="color: #0000FF;">Substring</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">7</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&lt;br/&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>       <span style="color: #008080; font-style: italic;">// result : 01</span></pre></td></tr></table></div>

<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/aspnet/how-to-use-string-substring-in-net.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>string.Equals compare with string.Compare Asp.Net</title>
		<link>http://www.aspgod.com/aspnet/string-equals-compare-with-string-compare-asp-net.html</link>
		<comments>http://www.aspgod.com/aspnet/string-equals-compare-with-string-compare-asp-net.html#comments</comments>
		<pubDate>Fri, 28 Aug 2009 02:54:18 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[case sensitive]]></category>
		<category><![CDATA[string compare]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/myprofile/?p=320</guid>
		<description><![CDATA[When compare the string with not sure that the case of the string like (&#8220;aAa&#8221;, &#8220;aaa&#8221;, &#8220;AAA&#8221;). Normally I used the string.ToLower() to manage this problem but there&#8217;re many way to solved this. Look at my code below. 1 string.Compare&#40;s1, s2, true&#41; This function return integer. s1 > s2 then return 1 s1 < s2 [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>When compare the string with not sure that the case of the string like (&#8220;aAa&#8221;, &#8220;aaa&#8221;, &#8220;AAA&#8221;). Normally I used the string.ToLower() to manage this problem but there&#8217;re many way to solved this. Look at my code below.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Compare</span><span style="color: #008000;">&#40;</span>s1, s2, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span></pre></td></tr></table></div>

<p>This function return integer.<br />
s1 > s2 then return 1<br />
s1 < s2 then return -1<br />
s1 = s2 then return 0<br />
The 3rd pamerater is the "ignoreCase" then set it true to non-case sensitive</p>
<p><strong>Example</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">string</span> s1 <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;aAa&quot;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>s1<span style="color: #008000;">.</span><span style="color: #0000FF;">Equals</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;aaa&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008080; font-style: italic;">// false because the case sensitive</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">// do something</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>s1 <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;aaa&quot;</span><span style="color: #008000;">&#41;</span> <span style="color: #008080; font-style: italic;">// false because the case sensitive</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">// do something</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Compare</span><span style="color: #008000;">&#40;</span>s1, <span style="color: #666666;">&quot;aaa&quot;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">==</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008080; font-style: italic;">// true enable non-case sensitive</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">// do something</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/aspnet/string-equals-compare-with-string-compare-asp-net.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2 Languages Website by ASP.NET</title>
		<link>http://www.aspgod.com/aspnet/2-languages-website-by-asp-net.html</link>
		<comments>http://www.aspgod.com/aspnet/2-languages-website-by-asp-net.html#comments</comments>
		<pubDate>Mon, 03 Aug 2009 04:21:18 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[2 Languages Website]]></category>
		<category><![CDATA[Languages URL]]></category>
		<category><![CDATA[multi Languages]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/myprofile/?p=284</guid>
		<description><![CDATA[This is a simple trick to make a 2 Languages Website. You have to get to real path then put the querystring after that path. Let&#8217;s see this example. Put this code at the Page_Load in the MasterPage File or any page you want. string[] allKey = Request.QueryString.AllKeys; string qString = &#8220;?&#8221;; for (int i [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>This is a simple trick to make a 2 Languages Website. You have to get to real path then put the querystring after that path. Let&#8217;s see this example.</p>
<p>Put this code at the Page_Load in the MasterPage File or any page you want.</p>
<blockquote><p>
string[] allKey = Request.QueryString.AllKeys;<br />
string qString = &#8220;?&#8221;;<br />
for (int i = 0; i < allKey.Length; i++)<br />
{<br />
    if (allKey[i].ToLower() != "lang")<br />
    {<br />
        {<br />
            qString += allKey[i] + "=" + Request.QueryString[allKey[i]] + "&#038;";<br />
        }<br />
    }<br />
}<br />
hrefThai.HRef = Request.Url.AbsoluteUri.Split('?')[0] + qString + "lang=th";<br />
hrefEng.HRef = Request.Url.AbsoluteUri.Split('?')[0] + qString + "lang=en";
</p></blockquote>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/aspnet/2-languages-website-by-asp-net.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pointer in C# (.NET) and why .NET not allow to use as safe</title>
		<link>http://www.aspgod.com/aspnet/pointer-in-c-net-and-why-net-not-allow-to-use-as-safe.html</link>
		<comments>http://www.aspgod.com/aspnet/pointer-in-c-net-and-why-net-not-allow-to-use-as-safe.html#comments</comments>
		<pubDate>Fri, 10 Jul 2009 07:50:55 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[pointer]]></category>
		<category><![CDATA[pointer in C#]]></category>
		<category><![CDATA[pointer in VB]]></category>
		<category><![CDATA[unsafe]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/myprofile/?p=257</guid>
		<description><![CDATA[I tried to use pointer in C# because I use to do the same in C++. But I cann&#8217;t do this in .NET (C#) cause the pointer is unsafe with every reason. 1. Pointer can point to every address. 2. If you cann&#8217;t control the pointer well as &#8220;Memory Leak&#8221; then you will get the [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I tried to use pointer in C# because I use to do the same in C++. But I cann&#8217;t do this in .NET (C#) cause the pointer is unsafe with every reason.<br />
1. Pointer can point to every address.<br />
2. If you cann&#8217;t control the pointer well as &#8220;Memory Leak&#8221; then you will get the memory problem.<br />
3. You will get the error If you destry one object and there were some pointer still point to that object. That pointer will point to null.</p>
<p>The problem above show the unsafe of pointer then .Net not allow to use it. Because of most reason to use pointer will use for the low level programming. So C++ or VB6 will be better to use it. <img src='http://www.aspgod.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>I have searched the google and found one reference site that explain why you cann&#8217;t use pointer in .NET. This article is awsome. Let&#8217;s see this reference : <a href="http://www.dotnetspider.com/resources/313-Pointers-C-writing-Unsafe-code.aspx" target="_blank">unsafe .NET pointer</a></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/aspnet/pointer-in-c-net-and-why-net-not-allow-to-use-as-safe.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

