<?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>Phong LeeHae</title>
	<atom:link href="http://phongleehae.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://phongleehae.wordpress.com</link>
	<description>Programming in my brain, Girl friend in my heart.</description>
	<lastBuildDate>Mon, 23 Nov 2009 01:46:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='phongleehae.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Phong LeeHae</title>
		<link>http://phongleehae.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://phongleehae.wordpress.com/osd.xml" title="Phong LeeHae" />
	<atom:link rel='hub' href='http://phongleehae.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Static FBML เพื่อนคู่ใจ facebook content editor</title>
		<link>http://phongleehae.wordpress.com/2009/11/23/facebook-static-fbml/</link>
		<comments>http://phongleehae.wordpress.com/2009/11/23/facebook-static-fbml/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 01:46:36 +0000</pubDate>
		<dc:creator>phongleehae</dc:creator>
				<category><![CDATA[Driving on facebook]]></category>

		<guid isPermaLink="false">http://phongleehae.wordpress.com/?p=34</guid>
		<description><![CDATA[เพื่อนๆคงรู้กันแล้วนะครับ เมื่อเรา create page ใน facebook ซึ่งเรามักจะเรียกกันว่า fan page, facebook จะแบ่งหน้า profile ของ fan page ออกเป็นส่วนๆ โดยใช้ tab เป็นตัวแบ่ง โดยมี tab ที่รู้จักกันดีอย่างเช่น Wall หน้าที่ fan มา comment ใน profile ของ fan page Info บอกว่า fan page นี้เป็นใคร คน สัตว์ หรือสิ่งของ Photos รูปภาพต่างๆ แยกตามอัลบั้ม Video วีดีโอต่างๆที่ เรา upload Discussion เว็บบอร์ดที่ fan ใช้ในการติดต่อสื่อการกับเรา Reviews ที่แฟนๆ มาเขียน review [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phongleehae.wordpress.com&amp;blog=9215804&amp;post=34&amp;subd=phongleehae&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>เพื่อนๆคงรู้กันแล้วนะครับ เมื่อเรา create page ใน facebook ซึ่งเรามักจะเรียกกันว่า fan page, facebook จะแบ่งหน้า profile ของ fan page ออกเป็นส่วนๆ โดยใช้ tab เป็นตัวแบ่ง โดยมี tab ที่รู้จักกันดีอย่างเช่น<br />
Wall หน้าที่ fan มา comment ใน profile ของ fan page<br />
Info บอกว่า fan page นี้เป็นใคร คน สัตว์ หรือสิ่งของ<br />
Photos รูปภาพต่างๆ แยกตามอัลบั้ม<br />
Video วีดีโอต่างๆที่ เรา upload<br />
Discussion เว็บบอร์ดที่ fan ใช้ในการติดต่อสื่อการกับเรา<br />
Reviews ที่แฟนๆ มาเขียน review ให้กับ ผลิตภันฑ์ว่าดีหรือไม่ดีอย่างไร</p>
<p><img src="http://phongleehae.files.wordpress.com/2009/11/original_tab_facebook.jpg?w=500&#038;h=248" alt="original tab facebook" title="original_tab_facebook" width="500" height="248" class="alignnone size-full wp-image-49" /></p>
<p>tab เหล่านี้ก็จะแสดงมากบ้างน้อยบ้างแตกต่างกันตาม fan page ของแต่ละคน เนื่องจากเราสามารถซ่อนและแสดงได้ โดยการคลิกที่เครื่องหมายบวกใหญ่ๆทางขวาสุดของ tab bar หรือถ้าจะเอาออกก็คลิกที่รูปดินสอเล็ก ของ tab ที่ต้องการเอาออก แล้วเลือก remove tab</p>
<p>คราวนี้ เพื่อนๆบางคน คงจะเคยเห็น บาง fan page มี tab แปลกๆ ที่ไม่ได้อยู่ในรายการของ tab ที่ facebook สร้างเอาไว้ให้ อย่างเช่น tab Mazda 2 Life ใน fan page ของผม อย่างนี้</p>
<p><img src="http://phongleehae.files.wordpress.com/2009/11/mazda2life1.jpg?w=500&#038;h=374" alt="facebook tab" title="mazda2life" width="500" height="374" class="alignnone size-full wp-image-45" /></p>
<p>tab พิเศษพวกนี้เราสามารถสร้างเพิ่มเข้าไปได้จาก application ตัวนึงที่ facebook จัดเตรียมไว้ให้ นั่นก็คือ Static FBML<br />
โดยอันดับแรกให้เข้าไป <a target="_blank" href="http://www.facebook.com/staticfbml/#/apps/application.php?id=4949752878">ที่นี่</a> หรือ เพื่อนๆ สามารถ Search คำว่า่ Static FBML ในช่อง search เพื่อค้นหา</p>
<p>ต่อจากนั้นให้คลิกปุ่ม Add to my page แล้วจะมี popup ขึ้นมาให้เลือกหน้า fan page ของเราที่ต้องการเพิ่ม tab เข้าไป เมื่อเลือกได้แล้วก็กดที่ปุ่ม Add to page ที่ page นั้น</p>
<p><img src="http://phongleehae.files.wordpress.com/2009/11/static_fbml_add_to_my_page1.jpg?w=500&#038;h=323" alt="" title="Static_FBML_add_to_my_page" width="500" height="323" class="alignnone size-full wp-image-46" /></p>
<p>เมื่อเพิ่ม Static FBML มาที่ fan page ของเรากันแล้ว ที่นี้ก็มาถึงขั้นตอนการแก้ไข content ของ Tab ที่เพิ่งจะเพิ่มเข้ามา ก็ให้กลับมาที่ fan page ของตัวเองนะครับ แล้วคลิกที่ edit page ที่อยู่ข้างล่างรูป display ของเราแล้วเราจะถูกพามาที่หน้าที่รวมการแก้ไข tab ทุก tab ของเราไว้ที่หน้าเดียว ให้เลื่อนเพจลงมาหา tab ที่ชื่อว่า FBML อันนั้นแหละคือ tab ที่เราเพิ่งจะเพิ่มเข้ามา ให้คลิำกที่ link คำว่า edit</p>
<p><img src="http://phongleehae.files.wordpress.com/2009/11/fbml_tab.jpg?w=500&#038;h=271" alt="FBML Tab edit" title="FBML_tab" width="500" height="271" class="alignnone size-full wp-image-51" /></p>
<p>หลังจาก คลิก edit เราจะถูกพามาที่หน้าที่ใช้ในการแก้ไข content ของ tab Static FBML กันโดย Box Title ก็คือชื่อของ Tab และ FBML ก็คือ content ของ tab นั้นๆนั่นเอง</p>
<p><img src="http://phongleehae.files.wordpress.com/2009/11/fbml_editor.jpg?w=500&#038;h=248" alt="" title="FBML_Editor" width="500" height="248" class="size-full wp-image-53" /></p>
<p>สิ่งที่เราสามารถใส่ลงใน FBML ได้ก็คือ HTML ที่เราคุ้นเคยกันและ FBML ซึ่งเป็น tag พิเศษต่างๆที่ Faceboook จัดเตรียมไว้ให้เพื่อสามารถแสดง content ในลักษณะพิเศษได้ อย่างเช่นถ้าใส่ &lt;fb:fan profile_id=&#8221;YOUR_PAGE_ID&#8221; stream=&#8221;1&#8243; connections=&#8221;10&#8243; width=&#8221;300&#8243;&gt;&lt;/fb:fan&gt; และเปลี่ยน &#8220;YOUR_PAGE_ID&#8221; เป็น id ของ fan page ของคุณ facebook ก็จะแปลง tag นี้เป็น กล่องที่แสดงรายชื่อของ fan ของเราและแถมปุ่ม become a fan ให้ด้วยอย่างนี้</p>
<p> <img src="http://phongleehae.files.wordpress.com/2009/11/fan_box.jpg?w=500" alt="fan box" title="fan_box"   class="alignnone size-full wp-image-54" /></p>
<p>รายการของ FBML ที่ facebook ให้กับเราไว้มาดูกันได้ <a target="_blank" href="http://wiki.developers.facebook.com/index.php/Category:FBML_tags">ที่นี่</a> และขอเตือนอย่างหนึ่งว่า HTML ที่ใส่เข้าไปใน หน้า profile ของ facebook ห้ามมี IFRAME และ JAVASCIPT ครับผม และยังต้องตรงตามมาตรฐานที่ Facebook กำหนดไว้ครับ ถ้าใส่อะไรไปแล้วไม่ขึ้นแสดง แต่เรามั่นใจว่าใส่ถูกแล้ว นั่นแหละ facebook เค้าไม่ให้ใส่ล่ะ ^_^ และ facebook เค้าอนุญาตให้เราใส่ทั้ง HTML และ FBML ปนกันได้นะคร้าบบ</p>
<p>แต่ผมขอแนะนำเลยว่าถ้าวางเป็น Flash มาทั้งก้อนที่หน้านี้ แล้วพยายามไปเล่น navigation ภายใน Flash นั้นได้จะเป็นการดีที่สุด เพราะว่า ถ้าเป็น HTML แล้ว facebook มีข้อจำก้ัดพอสมควร แต่ถ้าเป็น Flash เราก็แค่วาง Flash เข้าไปที่ FBML โดยใช้  แล้วที่เหลือปล่อยให้ Flash จัดการความหวือหวาวิ๊ดวิ้วไป อย่างที่ Flash เค้าถนัดอยู่แล้วน่ะครับ</p>
<p>เมื่อตกแต่ง tab ของเรา กันอย่างหนำใจแล้วทีนี้ก็มาถึงวิธีเพิ่ม Tab ที่สร้างเข้ามาแสดงใน fan page ของเรา ง่ายๆเลยครับเพียงแค่เพื่อนๆคลิกที่ เครื่องหมาย + ใหญ่ๆ ข้างๆ tab list , tab ที่เราเพิ่งจะสร้างจะปรากฏอยู่ใน list ของ tab ที่ซ่อนอยู่เพียงแค่เราคลิกที่ชื่อ tab นั้น มันก็จะมาปรากฏอยู่ใน tab list ของเราโดยทันทีครับ</p>
<p><img src="http://phongleehae.files.wordpress.com/2009/11/add_tabs.jpg?w=500&#038;h=254" alt="add tab facebook" title="add_tabs" width="500" height="254" class="alignnone size-full wp-image-57" /></p>
<p>นอกจากนี้เรายังสามารถกำหนดให้ tab นี้เป็น landing page ได้อีกด้วยนะครับโดยเข้าไปกำหนดใน edit page -&gt; Wall Settings -&gt; Default Landing tab for everyone else. ตามรูปเลยครับ</p>
<p><img src="http://phongleehae.files.wordpress.com/2009/11/default_landing_tab.jpg?w=500&#038;h=192" alt="" title="default_landing_tab" width="500" height="192" class="alignnone size-full wp-image-58" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phongleehae.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phongleehae.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phongleehae.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phongleehae.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phongleehae.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phongleehae.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phongleehae.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phongleehae.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phongleehae.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phongleehae.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phongleehae.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phongleehae.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phongleehae.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phongleehae.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phongleehae.wordpress.com&amp;blog=9215804&amp;post=34&amp;subd=phongleehae&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phongleehae.wordpress.com/2009/11/23/facebook-static-fbml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0b31cbdf1e3c99314d0f38205ae8004b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">phongleehae</media:title>
		</media:content>

		<media:content url="http://phongleehae.files.wordpress.com/2009/11/original_tab_facebook.jpg" medium="image">
			<media:title type="html">original_tab_facebook</media:title>
		</media:content>

		<media:content url="http://phongleehae.files.wordpress.com/2009/11/mazda2life1.jpg" medium="image">
			<media:title type="html">mazda2life</media:title>
		</media:content>

		<media:content url="http://phongleehae.files.wordpress.com/2009/11/static_fbml_add_to_my_page1.jpg" medium="image">
			<media:title type="html">Static_FBML_add_to_my_page</media:title>
		</media:content>

		<media:content url="http://phongleehae.files.wordpress.com/2009/11/fbml_tab.jpg" medium="image">
			<media:title type="html">FBML_tab</media:title>
		</media:content>

		<media:content url="http://phongleehae.files.wordpress.com/2009/11/fbml_editor.jpg" medium="image">
			<media:title type="html">FBML_Editor</media:title>
		</media:content>

		<media:content url="http://phongleehae.files.wordpress.com/2009/11/fan_box.jpg" medium="image">
			<media:title type="html">fan_box</media:title>
		</media:content>

		<media:content url="http://phongleehae.files.wordpress.com/2009/11/add_tabs.jpg" medium="image">
			<media:title type="html">add_tabs</media:title>
		</media:content>

		<media:content url="http://phongleehae.files.wordpress.com/2009/11/default_landing_tab.jpg" medium="image">
			<media:title type="html">default_landing_tab</media:title>
		</media:content>
	</item>
		<item>
		<title>Jounal on ASP.NET</title>
		<link>http://phongleehae.wordpress.com/2009/08/28/jounal-on-asp-net/</link>
		<comments>http://phongleehae.wordpress.com/2009/08/28/jounal-on-asp-net/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 14:26:39 +0000</pubDate>
		<dc:creator>phongleehae</dc:creator>
				<category><![CDATA[ASP.NET Programming world]]></category>

		<guid isPermaLink="false">http://phongleehae.wordpress.com/?p=6</guid>
		<description><![CDATA[Code to render user control. StringBuilder sb = new StringBuilder(); StringWriter tw = new StringWriter(sb); HtmlTextWriter hw = new HtmlTextWriter(tw); Control c = LoadControl(&#8220;~/ProfileFBML.ascx&#8221;); Controls.Add(c); c.RenderControl(hw); Controls.Remove(c); string fbml = sb.ToString(); Only OnInit will fire if you call this code in OnLoad, so if you want data binding you must manually call DataBind() of the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phongleehae.wordpress.com&amp;blog=9215804&amp;post=6&amp;subd=phongleehae&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Code to render user control.</strong></p>
<p>StringBuilder sb = new StringBuilder();<br />
StringWriter tw = new StringWriter(sb);<br />
HtmlTextWriter hw = new HtmlTextWriter(tw);<br />
Control c = LoadControl(&#8220;~/ProfileFBML.ascx&#8221;);<br />
Controls.Add(c);<br />
c.RenderControl(hw);<br />
Controls.Remove(c);<br />
string fbml = sb.ToString();</p>
<p>Only OnInit will fire if you call this code in OnLoad, so if you want data binding you must manually call DataBind() of the user control.</p>
<p>I got this technique from http://kpumuk.info/facebook/generating-content-for-the-facebooks-setfbml-method-in-aspnet/</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Code to strip HTML tag&#8230;<br />
private static readonly Regex HtmlTagExpression = new Regex(@&#8221;(?&#8217;tag_start&#8217;\s]+)))?)+\s*|\s*)(?&#8217;tag_end&#8217;/?&gt;)&#8221;, RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Compiled);<br />
        private static readonly Regex WhiteSpaceBetweenHtmlTagsExpression = new Regex(@&#8221;&gt;(/w+)&lt;&quot;, RegexOptions.IgnoreCase | RegexOptions.Compiled);<br />
        private static readonly Regex HtmlLineBreakExpression = new Regex(@&quot;<br />&#8220;, RegexOptions.IgnoreCase | RegexOptions.Compiled);<br />
        private static readonly Dictionary&lt;string, List&gt; ValidHtmlTags = new Dictionary&lt;string, List&gt; {<br />
	        { &#8220;br&#8221;, new List() },<br />
	        { &#8220;i&#8221;, new List() },<br />
	        { &#8220;u&#8221;, new List() },<br />
	        { &#8220;a&#8221;, new List { &#8220;href&#8221; } },<br />
	        { &#8220;img&#8221;, new List { &#8220;src&#8221;, &#8220;height&#8221;, &#8220;width&#8221;, &#8220;alt&#8221; } },<br />
            { &#8220;object&#8221;, new List()}<br />
       };<br />
        public string StripHTML(string text)<br />
        {<br />
            if (String.IsNullOrEmpty(text))<br />
            {<br />
                return text;<br />
            }<br />
            return HtmlTagExpression.Replace(text, new MatchEvaluator((Match m) =&gt;<br />
            {<br />
                if (!ValidHtmlTags.ContainsKey(m.Groups["tag"].Value))<br />
                    return String.Empty;</p>
<p>                string generatedTag = String.Empty;</p>
<p>                System.Text.RegularExpressions.Group tagStart = m.Groups["tag_start"];<br />
                System.Text.RegularExpressions.Group tagEnd = m.Groups["tag_end"];<br />
                System.Text.RegularExpressions.Group tag = m.Groups["tag"];<br />
                System.Text.RegularExpressions.Group tagAttributes = m.Groups["attr"];</p>
<p>                generatedTag += (tagStart.Success ? tagStart.Value : &#8220;&lt;&quot;);<br />
                generatedTag += tag.Value;</p>
<p>                foreach (Capture attr in tagAttributes.Captures)<br />
                {<br />
                    int indexOfEquals = attr.Value.IndexOf(&#39;=&#39;);</p>
<p>                    // don&#39;t proceed any futurer if there is no equal sign or just an equal sign<br />
                    if (indexOfEquals &#8220;);</p>
<p>                return generatedTag;<br />
            }));<br />
        }</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p><strong>http://localhost/myTest/ShowURL.aspx?a=abc</strong><br />
With this URL the properties below return :<br />
Request.Url.AbsolutePath= /myTest/ShowURL.aspx<br />
Request.Url.AbsoluteUri= http://localhost/myTest/ShowURL.aspx?a=abc<br />
Request.Url.DnsSafeHost= localhost<br />
Request.Url.Host= localhost<br />
Request.Url.LocalPath= /myTest/ShowURL.aspx<br />
Request.Url.PathAndQuery= /myTest/ShowURL.aspx?a=abc<br />
Request.Url.Port= 80<br />
Request.Url.Query= ?a=abc<br />
Request.ApplicationPath= /myTest<br />
Request.PhysicalApplicationPath= D:\projects\myTest\<br />
Request.PhysicalPath= D:\projects\myTest\ShowURL.aspx<br />
Request.QueryString= a=abc<br />
Request.RawUrl= /myTest/ShowURL.aspx?a=abc</p>
<p><strong>http://chaiyapong.minteraction.local/mytest/showurl.aspx?param=value</strong><br />
for this url the result would be<br />
Request.Url.AbsolutePath= /mytest/showurl.aspx<br />
Request.Url.AbsoluteUri= http://chaiyapong.minteraction.local/mytest/showurl.aspx?param=value<br />
Request.Url.DnsSafeHost= chaiyapong.minteraction.local<br />
Request.Url.Host= chaiyapong.minteraction.local<br />
Request.Url.LocalPath= /mytest/showurl.aspx<br />
Request.Url.PathAndQuery= /mytest/showurl.aspx?param=value<br />
Request.Url.Port= 80<br />
Request.Url.Query= ?param=value<br />
Request.ApplicationPath= /myTest<br />
Request.PhysicalApplicationPath= D:\projects\myTest\<br />
Request.PhysicalPath= D:\projects\myTest\showurl.aspx<br />
Request.QueryString= param=value<br />
Request.RawUrl= /mytest/showurl.aspx?param=value</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>To reset identity value of indentity column of sql server you can use this command<br />
DBCC CHECKIDENT (TagTypes, RESEED, 0)<br />
it will set identity column to 0 that the next number will be 1.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>You cannot use HttpContext.Current in Global.asax because it always be null.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>Server.MapPath can use in Global.asax but only available in Application_Start Event.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>File.Create,File.ReadAllText,File.WriteAllText will lock your file, if you dont want to log your file while working with that file you must use<br />
<strong>CREATE :</strong><br />
FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.ReadWrite);<br />
fs.Close();<br />
<strong>READ:</strong><br />
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);<br />
StreamReader sr = new StreamReader(fs);<br />
string content = sr.ReadToEnd();<br />
sr.Close();<br />
<strong>WRITE:</strong><br />
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Write, FileShare.ReadWrite);<br />
StreamWriter sw = new StreamWriter(fs);<br />
sw.Write(content);<br />
sw.Close();</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phongleehae.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phongleehae.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phongleehae.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phongleehae.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phongleehae.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phongleehae.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phongleehae.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phongleehae.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phongleehae.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phongleehae.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phongleehae.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phongleehae.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phongleehae.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phongleehae.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phongleehae.wordpress.com&amp;blog=9215804&amp;post=6&amp;subd=phongleehae&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phongleehae.wordpress.com/2009/08/28/jounal-on-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0b31cbdf1e3c99314d0f38205ae8004b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">phongleehae</media:title>
		</media:content>
	</item>
	</channel>
</rss>
