<?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>Michael Sync &#187; ASP.NET</title>
	<atom:link href="http://michaelsync.net/category/aspnet/feed" rel="self" type="application/rss+xml" />
	<link>http://michaelsync.net</link>
	<description>Sharing our knowledge</description>
	<lastBuildDate>Thu, 05 Apr 2012 07:37:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Building ASP.NET MVC, Web API, and Web Pages source code</title>
		<link>http://michaelsync.net/2012/04/01/building-asp-net-mvc-web-api-and-web-pages-source-code</link>
		<comments>http://michaelsync.net/2012/04/01/building-asp-net-mvc-web-api-and-web-pages-source-code#comments</comments>
		<pubDate>Mon, 02 Apr 2012 05:42:50 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=2212</guid>
		<description><![CDATA[Update #1: Brad Wilson replied me as below ~ Paul Betts has diagnosed this as having some auto-generated files which are currently UTF16, which Git does not support. I&#8217;m working to figure out exactly how widespread the problem is. Seems like...]]></description>
			<content:encoded><![CDATA[<p><strong>Update #1:</strong> Brad Wilson replied me as below ~</p>
<blockquote><p>Paul Betts has diagnosed this as having some auto-generated files which are currently UTF16, which Git does not support. I&#8217;m working to figure out exactly how widespread the problem is.</p></blockquote>
<p>Seems like codeplex is having the encoding problem with UTF16 file on git repository.</p>
<p><strong>Update #2:</strong> Brad Wilson said that he has fixed that file. I re-pulled the repo again and tested it.. It works! </p>
<h1>Introduction</h1>
<p><a href="http://michaelsync.net/wp-content/uploads/2012/04/Building-ASP.NET-MVC-sourcecode.png"><img class="alignnone size-full wp-image-2220" title="Building ASP.NET MVC sourcecode" src="http://michaelsync.net/wp-content/uploads/2012/04/Building-ASP.NET-MVC-sourcecode.png" alt="" width="760" height="560" /></a></p>
<p>Scott Guthrie announced that Microsoft is releasing the source code of ASP.NET Web API and ASP.NET Web Pages (aka Razor) under an open source license (Apache 2.0). They will be accepting the contributions from community as well. What a great news for us! I&#8217;m really happy to see more open source projects coming out from Microsoft.</p>
<p><a href="http://michaelsync.net/wp-content/uploads/2012/03/aspnet-250x250.png"><img class="alignnone size-full wp-image-2216" title="aspnet-250x250" src="http://michaelsync.net/wp-content/uploads/2012/03/aspnet-250x250.png" alt="" width="100" height="100" /></a></p>
<p>Even though I&#8217;m currently occupied with my school, work and etc, I tried downloading the source code from codeplex and building it with a lot and lot of love. (If you don&#8217;t know how to install git on your machine, please follow this post &#8220;<a href="http://help.github.com/win-set-up-git/">Set Up Git</a>&#8221; from github. )</p>
<ul>
<li><strong>Git</strong>: git clone https://git01.codeplex.com/aspnetwebstack.git</li>
</ul>
<p>I got the following folders once I cloned the git repository.</p>
<p><a href="http://michaelsync.net/wp-content/uploads/2012/03/File-Explorer.png"><img class="alignnone size-full wp-image-2213" title="File Explorer" src="http://michaelsync.net/wp-content/uploads/2012/03/File-Explorer.png" alt="" width="476" height="423" /></a></p>
<p>The first thing that I need to do is to restore the nuget packages. Microsoft put the nuget configuration file only instead of  all those third-party assemblies that are required to build the source code. This can be achieved by running &#8220;build RestorePackages&#8221; from the root of the repository that I just cloned.</p>
<p><img class="alignnone size-full wp-image-2214" title="Build RestorePackages" src="http://michaelsync.net/wp-content/uploads/2012/03/Build-RestorePackages.png" alt="" width="676" height="136" /></p>
<p>You can enable the nuget restore permanently by adding this system variable in your environment.</p>
<p><a href="http://michaelsync.net/wp-content/uploads/2012/03/EnableNuGetPackageRestore.png"><img class="alignnone size-full wp-image-2215" title="EnableNuGetPackageRestore" src="http://michaelsync.net/wp-content/uploads/2012/03/EnableNuGetPackageRestore.png" alt="" width="513" height="502" /></a></p>
<p>Otherwise, you will get this error.</p>
<blockquote><p>Error 1 NuGet package restore is not currently enabled. For more information, please see: http://aspnetwebstack.codeplex.com/wikipage?title=NuGet+Packages System.Web.Razor</p></blockquote>
<p>According to the <a href="http://aspnetwebstack.codeplex.com/documentation">official document</a>, we need to download &#8220;<a href="http://www.codeplex.com/Download?ProjectName=aspnetwebstack&amp;DownloadId=360565">SkipStorngNames</a>&#8221; and run “skipstrongnames -e&#8221; with admin right in command prompt but I didn&#8217;t do it on one of my machines and I can still build the whole code (including test) from VS10. I&#8217;m still pretty new to the code base so I will download and run it when I need.</p>
<h1>Errors and Warning</h1>
<p>When I tried building the solution, I got this error below.</p>
<blockquote><p>WebGrid\_WebGridRenderer.generated.cs(1,1): error CS0116: A namespace cannot directly contain members such as fields or methods [C:\aspnetwebstack\src\System.Web.Helpers\System.Web.Helpers.csproj]</p></blockquote>
<p>I thought that the auto-generated code got screwed up so I deleted everything from that file and tried saving the _WebGridRenderer.cshtml again. Nothing was generated and found two warnings below.</p>
<blockquote><p>Warning 8 C:\Michael Sync\++ Project\aspnetwebstack\aspnetwebstack\src\System.Web.Helpers\WebGrid\_WebGridRenderer.cshtml: ASP.NET runtime error: There is no build provider registered for the extension &#8216;.cshtml&#8217;. You can register one in the &lt;compilation&gt;&lt;buildProviders&gt; section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value &#8216;Web&#8217; or &#8216;All&#8217;. C:\Michael Sync\++ Project\aspnetwebstack\aspnetwebstack\src\System.Web.Helpers\WebGrid\_WebGridRenderer.cshtml 1 1 System.Web.Helpers</p>
<p>Warning 1 Cannot find custom tool &#8216;RazorHelperGenerator&#8217; on this system. C:\Michael Sync\++ Project\aspnetwebstack\aspnetwebstack\src\System.Web.Helpers\WebGrid\_WebGridRenderer.cshtml System.Web.Helpers</p></blockquote>
<h1>(Temp?) Solution</h1>
<p>Ok! There are a lot of doubts and questions but I will share the way that I fixed in order to build the solution without any error.</p>
<p>The main problem that we can&#8217;t build is that _WebGridRenderer.generated.cs file has weird non-English characters but when you look at <a href="http://aspnetwebstack.codeplex.com/SourceControl/changeset/view/ef2dfab3f6fb#src%2fSystem.Web.Helpers%2fWebGrid%2f_WebGridRenderer.generated.cs">that file</a> in browser, you can see the English version.</p>
<p>The picture below shows the differences between the file that I have and the file on server.</p>
<p><a href="http://michaelsync.net/wp-content/uploads/2012/04/git-vs-web.png"><img class="alignnone size-full wp-image-2227" title="git vs web" src="http://michaelsync.net/wp-content/uploads/2012/04/git-vs-web.png" alt="" width="1304" height="768" /></a></p>
<p>So, I manually copied it from browser (downloading the code as zip file doesn&#8217;t work either) and override everything in _WebGridRenderer.generated.cs. After that, it works.</p>
<p>If you are desperately willing to build the code right now, you can follow what I did. I will keep you updated once I found something useful.</p>
<h1>Conclusion</h1>
<p>You are no longer need to use the temp solution that I mentioned above.. The coordinator from project has fixed the issue and you should be able to re-pull the repository and can build the project already.</p>
<p>Thanks!
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2012/04/01/building-asp-net-mvc-web-api-and-web-pages-source-code&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2012/04/01/building-asp-net-mvc-web-api-and-web-pages-source-code/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Date Issue in Excel Export</title>
		<link>http://michaelsync.net/2012/03/31/date-issue-in-excel-export</link>
		<comments>http://michaelsync.net/2012/03/31/date-issue-in-excel-export#comments</comments>
		<pubDate>Sat, 31 Mar 2012 08:36:12 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=2161</guid>
		<description><![CDATA[This is just a tip on solving date issue in exporting the excel file from ASP.NET. Introduction One of my guys was using this following code to export the excel file from ASP.NET application. The code is very simple. He...]]></description>
			<content:encoded><![CDATA[<p>This is just a tip on solving date issue in exporting the excel file from ASP.NET.</p>
<h1>Introduction</h1>
<p>One of my guys was using this following code to export the excel file from ASP.NET application. The code is very simple. He created the datatable with the data that he wants to export from database. He bind that datatable with datagrid, write the HTML code to HtmlTextWriter and write those HTML code to the response with &#8220;application/vnd.ms-excel&#8221; content type.</p>
<p><strong>Download</strong></p>
<ul>
<li>git : <a href="https://github.com/michaelsync/Michael-Sync-s-blog-sample">https://github.com/michaelsync/Michael-Sync-s-blog-sample</a></li>
<li>zip : <a href="https://github.com/michaelsync/Michael-Sync-s-blog-sample/blob/master/Excel-Export-DateTime/Zip/Excel-Export-DateTime.zip">Excel-Export-DateTime.zip (8KB)</a></li>
</ul>
<pre class="brush: csharp; title: ; notranslate">
protected void Button1_Click(object sender, EventArgs e) {
            var datatable = CreateDataTableWithData();

            System.IO.StringWriter stringWriter = GetHtmlTagsfromDatagrid(datatable);

            WriteResponse(stringWriter);
        }

        private void WriteResponse(System.IO.StringWriter stringWriter) {
            Response.Clear();
            Response.Charset = &quot;UTF-8&quot;;
            Response.ContentEncoding = System.Text.Encoding.GetEncoding(&quot;UTF-8&quot;);
            Response.ContentType = &quot;application/vnd.ms-excel&quot;;
            Response.ContentEncoding = System.Text.Encoding.Unicode;
            Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());
            Response.AppendHeader(&quot;Content-Disposition&quot;, &quot;attachment;filename=myexcel.xls&quot;);
            Response.Write(stringWriter.ToString());
            Response.End();
        }

        private static System.IO.StringWriter GetHtmlTagsfromDatagrid(DataTable datatable) {
            System.IO.StringWriter stringWriter = new System.IO.StringWriter();
            HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWriter);
            DataGrid dg = new DataGrid();
            dg.DataSource = datatable;
            dg.DataBind();
            dg.RenderControl(htmlWrite);
            return stringWriter;
        }

        private static DataTable CreateDataTableWithData() {
            var datatable = CreateDataTable();

            datatable.Rows.Add(CreateDataRow(datatable, 1, &quot;Michael Sync&quot;,
                &quot;8/31/1982 3:19:40 PM&quot;));
            datatable.Rows.Add(CreateDataRow(datatable, 1, &quot;Shwesin Sync&quot;,
                &quot;9/29/1982 3:00:32 PM&quot;));
            datatable.Rows.Add(CreateDataRow(datatable, 1, &quot;Elena Sync&quot;,
                &quot;1/15/2011 00:00:01 PM&quot;));
            datatable.Rows.Add(CreateDataRow(datatable, 1, &quot;Tiffany Sync&quot;,
                &quot;7/6/2012 00:00:01 PM&quot;));

            datatable.AcceptChanges();
            return datatable;
        }

        private static DataTable CreateDataTable() {
            var datatable = new DataTable();
            datatable.Columns.Add(&quot;Id&quot;);
            datatable.Columns.Add(&quot;Name&quot;);
            datatable.Columns.Add(&quot;Date of Birth&quot;);
            return datatable;
        }

        private static DataRow CreateDataRow(DataTable datatable, int id, string name, string dob) {
            DataRow dr = datatable.NewRow();
            dr[0] = id;
            dr[1] = name;
            //dr[2] = string.Format(&quot;{0:yyyy-MM-dd HH:mm:ss}&quot;, dob); //Right code
            dr[2] = dob; // Wrong code

            return dr;
        }
</pre>
<h1>Problem</h1>
<p>We are able to view the exported file in excel but the problem is that the date formats are not consistent for all rows. Take a look at Elena&#8217;s b&#8217;day and Tifa&#8217;s b&#8217;day in this screenshot below. The date formats are different, right?</p>
<p><img class="alignnone size-full wp-image-2163" title="Excel" src="http://michaelsync.net/wp-content/uploads/2012/03/Excel.png" alt="" width="278" height="134" /></p>
<h1>Why?</h1>
<p>This problem occurred because Excel is using the formats from regional setting. The format of short date in my system is M/d/yyyy and the long date format is dddd/MMMM dd,yyyy. All data that follows those date format will be treated as a date in excel. Otherwise, it will be treated as a string. If you look at my b&#8217;day &#8220;8/31/1982 3:19:40 PM&#8221;, it doesn&#8217;t follow dddd/MMMM dd,yyyy format so excel treat it as a string.</p>
<p><a href="http://michaelsync.net/wp-content/uploads/2012/03/Region-and-Language-Setting.png"><img class="alignnone size-full wp-image-2162" title="Region and Language Setting" src="http://michaelsync.net/wp-content/uploads/2012/03/Region-and-Language-Setting.png" alt="" width="477" height="550" /></a></p>
<h1>Solution</h1>
<p>There are more than one solution for this problem. You can specify &#8220;vnd.ms-excel.numberformat:dd/mm/yy&#8221; style to that cell. but the easiest fix that we came up is to set the date format as below while populating the data.</p>
<pre class="brush: csharp; title: ; notranslate">
dr[2] = string.Format(&quot;{0:yyyy-MM-dd HH:mm:ss}&quot;, dob); //Right code
</pre>
<h1>Conclusion</h1>
<p>It&#8217;s just a simple issue and simple solution but we did face this issue so I&#8217;m sharing it here. Hopefully, developers who are facing the same problem might find this post useful. :)</p>
<p><del>Happy Silverlighting!</del> Oh no! Happy sharing!!</p>
<p><strong>Related ~</strong></p>
<ul>
<li><a href="http://cosicimiento.blogspot.com/2008/11/styling-excel-cells-with-mso-number.html">Styling Excel cells with mso-number-format</a></li>
<li><a href="http://www.planet-source-code.com/vb/scripts/ShowCodeAsText.asp?txtCodeId=398&amp;lngWId=6">HTML to Excel conversion</a></li>
</ul>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2012/03/31/date-issue-in-excel-export&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2012/03/31/date-issue-in-excel-export/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codeproject Highlight</title>
		<link>http://michaelsync.net/2007/12/09/codeproject-highlight</link>
		<comments>http://michaelsync.net/2007/12/09/codeproject-highlight#comments</comments>
		<pubDate>Sun, 09 Dec 2007 17:47:57 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Fav Links]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Smart Client]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/12/09/codeproject-highlight</guid>
		<description><![CDATA[Do you want to be informed the best stuffs of Codeproject every months? I have one good news for you. I&#8217;m gonna launch one new program called &#8220;Codeproject Highlight&#8221; started from this month in my blog. In this program, there...]]></description>
			<content:encoded><![CDATA[<p>Do you want to be informed the best stuffs of Codeproject every months? I have one good news for you. I&#8217;m gonna launch one new program called &#8220;Codeproject Highlight&#8221; started from this month in my blog. In this program, there will be there parts such as news, the best articles and the best posts in CP forum (mostly are from ASP.NET, Web development and C#. ).</p>
<p>The main reason why I start this program is that it saves your time for reading all of latest articles from CP&#8217;s feed and tracking all questions and answers from Codeproject forum. </p>
<h2>News</h2>
<p><strong>Site Upgrading</strong></p>
<p>The whole Codeproject site has been upgraded from Classic ASP to ASP.NET version with a lot of improvements . This is really big changes which is done during <a href="http://michaelsync.net/2007/11/15/happy-birthday-codeproject" title="Happy Birthday CP!" target="_blank">8 years of running</a>. As this site has really huge amount of traffic, it&#8217;s very hard for them to upgrade this site with new version. However, the CP development team has done the great job to upgrade the whole site successfully. Congratulation! CP team</p>
<p>Chris shared a few interesting things <a href="http://www.codeproject.com/script/Forums/View.aspx?fid=1159&#038;msg=2345282">here</a> ~</p>
<blockquote><p>For those interested here are some whacky and amusing things we found:</p>
<ul>
<li>SQL Server, IIS and the ASP.NET framework are possessed.</li>
<li>Using development settings instead of production settings is a Bad Thing.</li>
<li>Storing session state in a SQL database can be a performance killer. Especially when the database is an old P4 test harness machine 40 km away from the webserver. That was an interesting experience in scream therapy.</li>
<li>Always check your indexes. Especially the ones that absolutely positively are not and cannot be fragmented. They will be the ones most in need of attention.</li>
<li>20,000 users hitting your application is wonderful load testing. We did load test but our testing machines did not generate the load you guys can generate</li>
<li>no matter how many ways you check code there&#8217;s always an angle that you haven&#8217;t looked at. We&#8217;re finding errors in 10 mins of being on that we couldn&#8217;t find from 3 months of beta testing. This is just nature.</li>
</ul>
</blockquote>
<h2> The Best Articles</h2>
<ul>
<li> <strong>Silverlight 1.1 Fun and Games</strong> by Sacha Barber
<p><img src="http://michaelsync.net/wp-content/uploads/2007/12/silverlight-fun.png" alt="Silverlight Game and Fun" /></p>
<p>Sourcecode : <a href="http://www.codeproject.com/kb/silverlight/SLFun.aspx">Download Source</a></p>
<p>Note: This is an award-winning article of <a href="http://www.codeproject.com/Feature/VS2008/">Visual Studio 2008 Competition</a>. </p>
</li>
<li> <strong>Silverlight Alien Sokoban</strong> by Daniel Vaughan
<p>A fun Silverlight implementation of the game Sokoban. Contrasting Silverlight 1.1 and WPF, while showcasing some new features of C# 3.0, Expression Design, Expression Blend, and Visual Studio 2008.</p>
<p><img src='http://michaelsync.net/wp-content/uploads/2007/12/alien.jpg' alt='Silverlight Alien Sokoban' /></p>
<p>Sourcecode : <a href="http://www.codeproject.com/KB/silverlight/SilverlightGame.aspx">Download Source</a></p>
</li>
<li> <strong>Build Google IG-like Ajax Start Page</strong> by Omar Al Zabir
<p>Build a start page similar to Google IG in 7 nights using ASP.Net Ajax, .NET 3.0, Linq, DLinq and XLinq.</p>
<p><img src='http://michaelsync.net/wp-content/uploads/2007/12/ig-ajax.png' alt='Google IG' /></p>
<p>Sourcecode : <a href="http://www.codeproject.com/KB/ajax/MakingGoogleIG.aspx">Download Source</a></p>
<p>Demo : <a href="http://www.dropthings.com/">Ajax Web Portal</a></p>
</li>
<li> <strong>WCF / WPF Chat Application</strong> by Sacha Barber
<p>How to create a peer-to-peer chat application using Windows Communication Foundation</p>
<p><img src='http://michaelsync.net/wp-content/uploads/2007/12/wpt-chat.png' alt='Free Chatting Client in .NET' /></p>
<p>Sourcecode : <a href="http://www.codeproject.com/KB/WCF/WCFWPFChat.aspx">Download Source</a></p>
</li>
<li> <strong>ASP.NET Popup Control</strong> by Tomas Petricek
<p>Highly customizable JavaScript popup control for web page wrapped in ASP.NET custom control.</p>
<p><img src='http://michaelsync.net/wp-content/uploads/2007/12/aspnet-popup-custcols.png' alt='ASP.NET Popup Control' /></p>
<p>Sourcecode : <a href="http://www.codeproject.com/KB/custom-controls/asppopup.aspx">Download Source</a></p>
</li>
</ul>
<p>Links</p>
<ul>
<li><a href="http://www.codeproject.com/KB/aspnet/Google_Pagerank.aspx">Request Google´s Pagerank programmatically</a></li>
<li><a href="http://www.codeproject.com/KB/aspnet/10_SEO_Tips.aspx">10 SEO tips for your ASP.NET website</a></li>
<li><a href="http://www.codeproject.com/KB/aspnet/AntiBot__quot_CAPTCHA_quo.aspx">Building ASP.NET Bot protection (CAPTCHA-like)</a></li>
<li><a href="http://www.codeproject.com/KB/aspnet/Protect_files_to_downloas.aspx">Protect files for download</a></li>
</ul>
<h2>The best posts in Codeproject forum</h2>
<ul>
<li><strong>How to store the password in Database? Encrypting Vs Hashing, Salt </strong>
<p>This is a discussion about storing the password in database. As the user authentication used to be a part of almost every software system, the developers should have good understanding about how to store the password in database. We have discussed about encrypting vs hashing, adding salt or adding the user name after the password and etc. </p>
<p>Summary</p>
<ul>
<li>Don&#8217;t use encryption/decryption for password.</li>
<li>Don&#8217;t need to append the user name to the password.</li>
<li>Hashing the password with random salt (SHA2 might be the best for hashing.)</li>
</ul>
<p>You can read about it in the link below. </p>
<p>Read More ~ <a href="http://www.codeproject.com/script/Forums/View.aspx?fid=1159&#038;msg=2333796">guidelines on password encryption</a></p>
</li>
<li><strong>Does the System.Deployment namespace cover a great deal of scenarios?</strong>
<p>I have been asked <a href="http://www.codeproject.com/script/Forums/View.aspx?fid=369270&#038;msg=2312608">this question</a> regarding ClickOnce deployment in CP forum.  As I&#8217;m using ClickOnce APIs on SCSF (Smart Client Software Factory) project, I found a few missing things in System.Deployment namespace. The following are the things that ClickOnce can&#8217;t handle. </p>
<p>Summary </p>
<ul>
<li>No way to get the list of latest modules</li>
<li>The version of the whole application need to be updated if we wanna update just one module</li>
<li>ClickOnce doesn&#8217;t care about the version of assemblies.</li>
<li>DownloadFileGroup (&#8220;&#8221;) works only if &#8220;optional&#8221; is checked. There is no way to download the group of file by force</li>
</ul>
<p>Read More ~  <a href="http://www.codeproject.com/script/Forums/View.aspx?fid=369270&#038;msg=2312648">An application that will get the updates from server automatically</a>
</li>
<li><strong>ADODB.DataTypeEnum.adBigInt problem &#8220;Bad variable type!&#8221; in Windows 2000</strong>
<p>One people who are using ADODB in .NET asked the question below in our CP forum. </p>
<blockquote><p>The identity field of one of my SQL DB tables is a bigint, using ADODB to query the DB based on this bigint works fine in my XP machine, but gives me a &#8220;Bad variable type&#8221; error when I use my app in a W2000 machine.</p>
<p>The W2000 machine has every service pack issued by MS, what could be the problem?
</p></blockquote>
<p>Something works fine on XP doesn&#8217;t work on Windows 200 is very strange issue. As I never use ADODB (something that we used for VB6 projects in old days ) in .NET, I don&#8217;t have that experiences. <a href="http://www.codeproject.com/script/Forums/View.aspx?fid=12076&#038;msg=2313407">The possibilities</a> that I think of at that time did solve his problem. </p>
<p>The trick is that casting the original datatype (long datatype in his case) to double datatype. :) Honestly, I&#8217;m not so sure why we need to do this but it did solve the problem. </p>
<pre class="brush: vb; title: ; notranslate">
Cmd.Parameters.Append(Cmd.CreateParameter(&quot;TransId&quot;, ADODB.DataTypeEnum.adBigInt, 1, , CType(iTransId, Double)))
</pre>
<p>Read More ~ <a href="http://www.codeproject.com/script/Forums/View.aspx?fid=12076&#038;msg=2312850">In XP works fine, W2000: Bad variable type!</a>
        </li>
</ul>
<p>Okay. That&#8217;s all for now. This is just a taste of new thing in my blog. What do you think? Is it interesting? As this program is just started, your feedback is highly appreciated. I think that there are a few area that I can&#8217;t add in this post. Based on the feedback from all of you, I will make this program better and interesting.. If you like it, don&#8217;t forget to subscribe my feed ( <a href="http://michaelsync.net/feed">http://michaelsync.net/feed</a> ). </p>
<p>Thanks.
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/12/09/codeproject-highlight&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/12/09/codeproject-highlight/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Script# &#8211; Is Script# right for you?</title>
		<link>http://michaelsync.net/2007/11/25/script-is-script-right-for-you</link>
		<comments>http://michaelsync.net/2007/11/25/script-is-script-right-for-you#comments</comments>
		<pubDate>Sun, 25 Nov 2007 17:22:06 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/11/25/script-is-script-right-for-you</guid>
		<description><![CDATA[I was playing a lit bit with Script# and I have some thoughts that I wanna share you. ( If you have no idea about what Script# is then you can read this post &#8220;Script#: C# to Javascript converter[^] &#8220;....]]></description>
			<content:encoded><![CDATA[<p>I was playing a lit bit with Script# and I have some thoughts that I wanna share you.  ( If you have no idea about what Script# is then you can read this post &#8220;<a href="http://michaelsync.net/2007/10/29/script-c-to-javascript-converter">Script#: C# to Javascript converter</a>[<a href="http://michaelsync.net/2007/10/29/script-c-to-javascript-converter" target="_blank">^</a>] &#8220;.  )  I know that Script# is a great framework but it might not be right for all ASP.NET developers. The reason is that there are a few things which are not so convenience for me while I&#8217;m using Script#. But I don&#8217;t want to say that this framework is not for you. maybe, you might like it. In fact, I will give some facts that I&#8217;ve learnt about Script#. You decide whether Script# is right for you or not.</p>
<p>Contents</p>
<ol>
<li>Script#&#8217;s features</li>
<li>Writing the object-oriented code with Script#</li>
<li>Tools for generating the documentation and compressing the sourcecode</li>
<li>What we meant by Script# as a C# to Javascript Converter is ~</li>
<li>Script# as a new language</li>
<li>Debugging problem in Script#</li>
<li>Script# is not from Microsoft</li>
<li>Script# is not Opensource</li>
<li>Using the thirt-party Javascript library in Script#</li>
<li>Script# for ASP.NET Ajax developers and Vista Gadget developers</li>
</ol>
<h3>1. Script#&#8217;s features</h3>
<p>Script# supports the compile-time checking, intelliSense, class-viewer, reflection and etc. It helps you not to have any typo-errors (e.g. calling foo&#8217;() instead of foo();  foo(arg1, arg2) instead of foo(arg1); ) that the most of Javascript developers used to make. So, the benefit of using Script# is that it will improve your productivity.</p>
<p><img src="http://michaelsync.net/wp-content/uploads/2007/11/intellisense.jpg" alt="intellisense.jpg" /><em><br />
Fig: intelliSense<br />
</em><br />
<img src="http://michaelsync.net/wp-content/uploads/2007/11/tooltip.jpg" alt="tooltip.jpg" /><br />
<em>Fig: Tooltip<br />
</em><br />
<img src="http://michaelsync.net/wp-content/uploads/2007/11/compile-time-validation.gif" alt="Script# - Compile-time Validation" /><br />
<em>Fig: Compile-time validation</em></p>
<h3>2. Writing the object-oriented code with Script#</h3>
<p>Writing the object-oriented Javascript become so easy with Script#. As you know, writing the object-oriented code in Javascript and C# are quite different. If you are not so familiar with Javascript, you probably need to find the reference when you need to write the code with object-oriented concept. Now, it&#8217;s over. You can just write the object-oriented code in C# and Script# will convert this code to the object-oriented Javascript code.</p>
<h3>3. Tools for generating the documentation and compressing the sourcecode</h3>
<p>If you are using Script#, you won&#8217;t need any third-party tool (e.g. JSDoc, Javascript Compressor) for generating the documentation or compressing your javascript library. Script# already has the build-in feature for that purpose.</p>
<h3>4. What we meant by Script# as a C# to Javascript Converter is ~</h3>
<p>This is very important thing you need to understand before you start learning about Script#. As I said in <a href="http://michaelsync.net/2007/10/29/script-c-to-javascript-converter" title="Script#: C# to Javascript Converter">my previous article</a>, Script# is able to convert the C# code to Javascript. But it doesn&#8217;t mean that it can convert all C# code that you wrote in winform or webform. In order to convert the C# to Javascript via Script#, you have to write the Script#-specific code in C# then those codes will be converted to Javascript&#8230;</p>
<h3>5. Script# as a new language</h3>
<p>The syntax of Script# is not so similiar to the Javascript&#8217;s syntax. So, I feel like learning a new language to write the Javascript. Another problem is that it is so hard to find the equivalent syntax in Script#.</p>
<p>For example: <a href="http://projects.nikhilk.net/Lists/Discussion/Threaded.aspx?RootFolder=%2fLists%2fDiscussion%2fHow%20to%20access%20%27document%27%20of%20created%20DOMElement&amp;FolderCTID=0x0120020088F5CDA3C6DA554CB2098DAAD95802EA&amp;TopicsView=http%3A%2F%2Fprojects%2Enikhilk%2Enet%2FLists%2FDiscussion%2FScript%2520Discussions%2Easpx">How to access &#8216;document&#8217; of created DOMElement??</a>[<a href="http://projects.nikhilk.net/Lists/Discussion/Threaded.aspx?RootFolder=%2fLists%2fDiscussion%2fHow%20to%20access%20%27document%27%20of%20created%20DOMElement&amp;FolderCTID=0x0120020088F5CDA3C6DA554CB2098DAAD95802EA&amp;TopicsView=http%3A%2F%2Fprojects%2Enikhilk%2Enet%2FLists%2FDiscussion%2FScript%2520Discussions%2Easpx" target="_blank">^</a>]</p>
<p>In Javascript,</p>
<pre class="brush: jscript; title: ; notranslate">
var iframe = document.createElement(&quot;iframe&quot;);
var doc = iframe.contentWindow.document;
</pre>
<p>In Script#,</p>
<pre class="brush: csharp; title: ; notranslate">
using System;
using System.DHTML;
using ScriptFX;
using ScriptFX.UI;

public class MyScriptlet {

public static void Main(ScriptletArguments arguments) {
DOMElement _iframe = Document.CreateElement(&quot;iframe&quot;);
DOMElementExt contentWindowElement = (DOMElementExt)_iframe.GetAttribute(&quot;contentWindow&quot;);
DOMElement doc = contentWindowElement.document;

}
}

[IgnoreNamespace]
[Imported]
public class DOMElementExt : DOMElement {

[IntrinsicProperty]
public DOMElement document {
get { return null; }
}

[IntrinsicProperty]
public DOMElement body {
get { return null; }
}

[IntrinsicProperty]
public DOMElement src {
get { return null; }
}

[IntrinsicProperty]
public DOMElement firstChild {
get { return null; }
}
}
</pre>
<p>If you look at both examples, you will understand how hard to find the equivalent syntax in Script#. It&#8217;s okay if we can find the equivalent one. But what if Script# doesn&#8217;t support something that can be done with Javascript?</p>
<h3>6. Debugging problem in Script#</h3>
<p>Script# does support the compile-time validation but the problem is that you won&#8217;t be able to debug the C# code that you wrote. Instead, you will have to debug the Javascript code that generate by Script#. I think that it is the big issue for web developer. I don&#8217;t feel comfortable to debug those generated code.</p>
<h3>7. Script# is not from Microsoft</h3>
<p>Script# is not developed by Microsoft while the GWT is developed by Google. It has too much differences. Even thought Nikhil is an architect from Microsoft, Script# is just one of his pet projects.. So, I don&#8217;t think that he is gonna support his pet project all the time.. And I&#8217;m not so sure that Nikhil will add more features to this project or not..</p>
<h3>8. Script# is not Opensource</h3>
<p>Script# is not an opensource project. Actually, it&#8217;s absolutely okay for me to use the non-opensource projects (I&#8217;ve been using the Visual Studio since long long ago.) but there should be a group of people who are supporting this project, right? What if we need the bug-fixed?</p>
<h3>9. Using the thirt-party Javascript library in Script#</h3>
<p>The most of Javascript libraries /framework (e.g. <a href="http://www.prototypejs.org/">prototype</a>, <a href="http://script.aculo.us/">script.aculo.us</a>, <a href="http://developer.yahoo.com/yui/">Yahoo.UI</a>, <a href="http://extjs.com/">ExtJS</a>) are not written in Script#. So, you can&#8217;t use those libraries right away from your Script# code. I think you will have to create a wrapper class for those libraries in order to use them in your Script#-enabled projects.</p>
<h3>10. Script# for ASP.NET Ajax developers and Vista Gadget developers</h3>
<p>I think that Script# might be good for ASP.NET Ajax developers and Vista Gadget developers. As I&#8217;m not very familiar with those things, I&#8217;m not able to cover about this. I need your contributes for this fact.</p>
<p>Okay That&#8217;s all from my side. Feel free to let me know if you have any thought or comment. Thanks.
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/11/25/script-is-script-right-for-you&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/11/25/script-is-script-right-for-you/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Script#: C# to Javascript Converter</title>
		<link>http://michaelsync.net/2007/10/29/script-c-to-javascript-converter</link>
		<comments>http://michaelsync.net/2007/10/29/script-c-to-javascript-converter#comments</comments>
		<pubDate>Mon, 29 Oct 2007 16:57:08 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/10/29/script-c-to-javascript-converter</guid>
		<description><![CDATA[Have you heard about Script#? I heard about this toolkit last week even Nikhil started this project last year. I knew that there is a Java-to-Javascript converter called GWT (Google Web Toolkit) in Java World since long time back and...]]></description>
			<content:encoded><![CDATA[<p><em><strong>Have you heard about Script#? </strong></em>I heard about this toolkit last week even <a href="http://www.nikhilk.net/">Nikhil </a>started this project last year. I knew that there is a Java-to-Javascript converter called <a href="http://code.google.com/webtoolkit/" title="GWT - Google Web Toolkit">GWT (Google Web Toolkit)</a> in Java World since long time back and I thought that it might be good if we, the C# developers, also have that kinda tools for ASP.NET web development. Now, the dream come true. Nikhil created Script# project that can convert the C# code to Javascript. I think it is pretty interesting (and strange ) tool and I wonder how Script# will convert the C# code to Javascript. Anyway, I started learning about Script# on last Friday. I&#8217;m gonna share what I have learnt about it so far. If you are already familiar with this tool, please share your thoughts about this tool. Thanks.</p>
<h3><strong>Introduction</strong></h3>
<p><a href="http://projects.nikhilk.net/Projects/ScriptSharp.aspx">Script#</a> is a compiler that generate the Javascript instead of MSIL (Microsoft Intermediate Language) from C# sourcecode. Like <a href="http://code.google.com/webtoolkit/" title="GWT - Google Web Toolkit">GWT (Google Web Toolkit)</a> that can convert the Java code to browser-compliant JavaScript and HTML, Script# is able to convert the C# codes to Javascript (either human-readable format or compact one). It is the best tool for those who hate to write the Javascript in HTML view.</p>
<p>Sourcecode Download : <a href="http://michaelsync.net/demo/SSharp.zip">SSharp.zip</a></p>
<h3>Example 1 : Getting Started with Script#</h3>
<ul>
<li>Download the ScriptSharp.zip from <a href="http://projects.nikhilk.net/Projects/ScriptSharp.aspx">this link</a>.</li>
<li>Extract it and double-click ScriptSharp.msi to install the Script# (You should note that Script# is currently available for Microsoft Visual Studio 2005. If you wanna use Script# with Visual Studio 2008, please check-out <a href="http://projects.nikhilk.net/Lists/Discussion/Threaded.aspx?RootFolder=%2fLists%2fDiscussion%2fInstall%20Script%20On%20Visual%20Studio%202008%20beta2%20%28Orcas%29%20is%20very%20easy&amp;FolderCTID=0x0120020088F5CDA3C6DA554CB2098DAAD95802EA&amp;TopicsView=http%3A%2F%2Fprojects%2Enikhilk%2Enet%2FLists%2FDiscussion%2FScript%2520Discussions%2Easpx">this post</a>.)</li>
<li>Launch the Microsoft Visual Studio 2005 IDE and let&#8217;s create very sample Script# project<br />
<em>Note: I recommended you to run the VS 2005 IDE as an administrator if you are using Windows Vista series.</p>
<p></em><img src="http://michaelsync.net/wp-content/uploads/2007/10/runasadministrator.jpg" /></li>
<li>Click &#8220;Script#-Enabled Web site&#8221; Project Template from &#8220;New Web Site&#8221; dialog (File&gt;New&gt;Web Site)</li>
<li>We will create one button named &#8220;clickMeButton&#8221; and the div called &#8220;greetingDIV&#8221; within<br />
<form> tag.
<pre class="brush: xml; title: ; notranslate">
&lt;div&gt;
&lt;input type=&quot;button&quot;  id=&quot;clickmeButton&quot; value= &quot;Click Me&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div id=&quot;greetingDIV&quot; class=&quot;divbox&quot;&gt;
Hello buddy!!
&lt;/div&gt;
&lt;/div&gt;
</pre>
</p></form>
</li>
<li>Go to the design-view and right-click on &#8220;Scriptlet&#8221; control as picture below<img src="http://michaelsync.net/wp-content/uploads/2007/10/edit-c_-code.jpg" alt="Script# - Scriptlet Control" /></li>
<li>Select &#8220;Edit C# Code&#8221; on content menu.</li>
<li>Paste the following code in Scriptlet Editor
<pre class="brush: csharp; title: ; notranslate">
using System.DHTML;
using ScriptFX;
using ScriptFX.UI;public class MyScriptlet : IDisposable {private DOMEventHandler _clickHandler;

private MyScriptlet(ScriptletArguments arguments) {
_clickHandler = new DOMEventHandler(OnClickMeButton_Click);

DOMElement clickMeButton = Document.GetElementById(&quot;clickmeButton&quot;);
clickMeButton.AttachEvent(&quot;onclick&quot;, _clickHandler);
}

public static void Main(ScriptletArguments arguments) {
MyScriptlet scriptlet = new MyScriptlet(arguments);

}

public void Dispose() {
if (_clickHandler != null) {
DOMElement okButton = Document.GetElementById(&quot;clickmeButton&quot;);
okButton.DetachEvent(&quot;onclick&quot;, _clickHandler);
_clickHandler = null;
}
}

private void OnClickMeButton_Click() {
DOMElement divGreeting = Document.GetElementById(&quot;greetingDIV&quot;);
divGreeting.Style.Display = &quot;block&quot;;
}
}
</pre>
<p><img src="http://michaelsync.net/wp-content/uploads/2007/10/scriptlet-editor.jpg" alt="Script# - Scriptlet Editor" /></li>
<li>Click &#8220;Save and Close&#8221; on Scriptlet Editor</li>
<li>Build the web application and Press &#8220;F5&#8243; to run the application</li>
<li>(There is one button on the page.) Click this button.</li>
<li>&#8220;Hello Buddy!&#8221; message will be shown as picture below.<img src="http://michaelsync.net/wp-content/uploads/2007/10/example-1.jpg" alt="Script# - Example 1" /></li>
</ul>
<p>That&#8217;s.. You just created one script#-enabled webpage. Do you want to know what code Script# generated from your C# code? It&#8217;s easy. Just go to &#8220;View Source&#8221; and you will see the following script which is generated by Script#.</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
//&lt;![CDATA[
window.main = function main() {
Type.createNamespace('Scriptlet');

////////////////////////////////////////////////////////////////////////////////
// Scriptlet.MyScriptlet

Scriptlet.MyScriptlet = function Scriptlet_MyScriptlet(arguments) {
this._clickHandler = Delegate.create(this, this._onClickMeButton_Click);
var clickMeButton = $('clickmeButton');
clickMeButton.attachEvent('onclick', this._clickHandler);
}
Scriptlet.MyScriptlet.main = function Scriptlet_MyScriptlet$main(arguments) {
var scriptlet = new Scriptlet.MyScriptlet(arguments);
}
Scriptlet.MyScriptlet.prototype = {
_clickHandler: null,

dispose: function Scriptlet_MyScriptlet$dispose() {
if (this._clickHandler) {
var okButton = $('clickmeButton');
okButton.detachEvent('onclick', this._clickHandler);
this._clickHandler = null;
}
},

_onClickMeButton_Click: function Scriptlet_MyScriptlet$_onClickMeButton_Click() {
var divGreeting = $('greetingDIV');
divGreeting.style.display = 'block';
}
}

Scriptlet.MyScriptlet.createClass('Scriptlet.MyScriptlet', null, IDisposable);

// ---- Do not remove this footer ----
// Generated using Script# v0.4.2.0 (http://projects.nikhilk.net)
// -----------------------------------

ScriptFX.Application.current.run(Scriptlet.MyScriptlet);
}
ScriptHost.initialize([
'App_Scripts/ssfx.Core.js',
'App_Scripts/ssfx.UI.Forms.js'
]);
//]]&gt;
&lt;/script&gt;
</pre>
<p><em>Don&#8217;t you think that the generated Javascript code looks so similar to your C# code that you wrote in Scriptlet Editor?</em> Yes. This is one of the advantages of using Script#. <u>It can generate the human-readable Javascript that has the same structure as your C# code.</u> If you are not sure how to write the object-oriented code in Javascript, you can just write the code in C# with the rich features such as IntelliSense, refactoring, compile-time and let Script# convert the C# code to the object-oriented Javascript code.</p>
<p><em>Note: The sample is already attached in this post. Please check-out &#8220;Example1.aspx&#8221; in zip file.</em></p>
<p>Okay. We&#8217;ve just done one sample with Script#.  As the project is in very early stage, I notice that there are a few weak points and bugs in that project while I&#8217;m learning. And also,<u> I&#8217;m kinda agreed with </u><span class="author fn"><u>Dimitri Glazkov regarding on Script# project.</u> (Check-out his post <a href="http://glazkov.com/blog/agony-of-thousand-puppies/" title="GWT And Now Script#: The Agony of a Thousand Puppies">here</a>.) Anyway, let&#8217;s learn more about Script# and we&#8217;ll see whether we should use it in real project or not.</span></p>
<h3>Example 2 : Script# Ajax</h3>
<ul>
<li>Create the another Script#-enabled project</li>
<li>Add the &#8220;Generic Handler&#8221; to your project and name it &#8220;ExampleWebHandler.ashx&#8221;</li>
<li>Paste the following code in &#8220;ProcessRequest (HttpContext context)&#8221; function.
<pre class="brush: csharp; title: ; notranslate">
context.Response.ContentType = &quot;text/xml&quot;;
context.Response.Write(&quot;Hi &quot; + HttpUtility.HtmlEncode(context.Request.QueryString[&quot;name&quot;]) + &quot;!&quot;); </pre>
<p><em>Note: What this code does is that write the &#8220;Hi&#8221; after appending the name that came as a parameter in response.<br />
</em></li>
<li>Add one textbox to accept the user inputs, one button to invoke the server-side script and the div for displaying the result
<pre class="brush: xml; title: ; notranslate">
&lt;div&gt;
Please Enter your name : &amp;nbsp;&amp;nbsp;
&lt;input type=&quot;text&quot; id=&quot;nameTextBox&quot; /&gt; &amp;nbsp;&amp;nbsp;
&lt;input type=&quot;button&quot; id=&quot;sayHiButton&quot; value=&quot;Say Hi!!&quot;/&gt; &lt;br /&gt;&lt;br /&gt;
&lt;div id=&quot;result&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
</pre>
</li>
<li>Add the argument to your scriptlet control. (Right-click on Scriptlet control and select &#8220;Edit&#8221; Arguments. then, Add one member (Name: name and Value: ExampleWebHandler.ashx?name={0}))
<p><img src="http://michaelsync.net/wp-content/uploads/2007/10/edit-arguments.gif" alt="Edit Arguments - ScriptletArgument Collection Editor" /></li>
<li>then, Click &#8220;OK&#8221; to close the &#8220;ScriptletArgument Collection Editor&#8221;</li>
<li>Paste the following code in &#8220;Scriptlet Editor&#8221;
<pre class="brush: csharp; title: ; notranslate">
using System;
using System.DHTML;
using ScriptFX;
using ScriptFX.UI;
using ScriptFX.Net;

public class MyScriptlet : IDisposable {

private string _urlName;
private DOMEventHandler _clickHandler;
private XMLHttpRequest _request;
DOMElement resultDIV = null;

public static void Main(ScriptletArguments arguments) {
MyScriptlet scriptlet = new MyScriptlet(arguments);
}

public void Dispose() {
if (_clickHandler != null) {
DOMElement okButton = Document.GetElementById(&quot;sayHiButton&quot;);
okButton.DetachEvent(&quot;onclick&quot;, _clickHandler);
_clickHandler = null;
}
if (_request != null) {
_request.Onreadystatechange = (Callback)Delegate.Null;
_request.Abort();
_request = null;
}
}

private MyScriptlet(ScriptletArguments arguments) {
_urlName = arguments.name;

_clickHandler = new DOMEventHandler(OnSayHiButton_Click);

DOMElement clickMeButton = Document.GetElementById(&quot;sayHiButton&quot;);
clickMeButton.AttachEvent(&quot;onclick&quot;, _clickHandler);
}

private void OnSayHiButton_Click() {
InputElement nameTextBox = (InputElement)Document.GetElementById(&quot;nameTextBox&quot;);
resultDIV = Document.GetElementById(&quot;result&quot;);
resultDIV.Style.Display = &quot;block&quot;;

_request = new XMLHttpRequest();
_request.Onreadystatechange = this.OnRequestComplete;
_request.Open(&quot;GET&quot;, String.Format(_urlName, nameTextBox.Value.Escape()), /* async */ true);
_request.Send(null);
}

private void OnRequestComplete() {
if (_request.ReadyState == 4) {
//if (_request.Status == 200) {
_request.Onreadystatechange = (Callback)Delegate.Null;
if (resultDIV != null) {
resultDIV.ClassName =&quot;divbox&quot;;
resultDIV.InnerHTML = _request.ResponseText;
}
_request = null;
// }
}
else {
if (resultDIV != null) resultDIV.InnerHTML = @&quot;&lt;img src=&quot;&quot;./images/indicator_technorati.gif&quot;&quot;&gt;&quot;;
}
}
}
</pre>
<p><em>Note: I assumed that you already have some ideas about Ajax before reading this article.</p>
<p></em></li>
<li>Build the application and run it. (You will see one textbox and one button as you have added on the page.)</li>
<li>Type the name you like</li>
<li>Click &#8220;Say Hi!&#8221; button. (You will see the result as below with the name that you enter.)
<p><img src="http://michaelsync.net/wp-content/uploads/2007/10/example-2.jpg" /></li>
</ul>
<p>This demo is very sample that shows the way how to communicate between Script# code and the Server-side code. You can probably extends the web handler to get the more features as you need for your Script#-enabled application.</p>
<p><strong>Debugging the Script#-enabled application</strong></p>
<p>For IE Users, Go to &#8220;Debug-&gt;Windows-&gt;Script Explorer&#8221;  or Press &#8220;Ctl+Alt+N&#8221; while you are running the project. You will see the list of script files that are included in page. Select the script file that you wanna debug and set the breakpoint. You know <a href="http://www.google.com/search?q=how+to+debug+javascript+with+visual+studio&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a">how to debug the Javascript with Visual Studio 2005</a>, right?</p>
<p>For Firefox Users, Firebug is the best tool for debugging the Javascript.</p>
<p><strong>Yeah. It is so sad to say that you are not able to debug the C# code that you wrote. Instead, you will be debugging the Javascript code which is generated by Script# compiler..  </strong>It makes you feel like debugging the MSIL code after writing the C# in IDE even the generated code is so much like the C# code that you wrote and human-readable but it is by-design so we can do nothing.</p>
<p><strong>Conclusion</strong></p>
<p>I&#8217;m gonna stop learning the Script# project for today. I&#8217;ll read about building the Script# library and Vista Sidebar Gadget and will post them in my blog. For the time being, I do have a few disappointments in using Script#.  However, I will look more information about this project and I will share the conclusion with you.. If you are also learning this project like me, please let me know. We can probably discuss more about this project.. Thanks&#8230;</p>
<p><em><strong>More Information about Script# ~</strong></em></p>
<ul>
<li><a href="http://www.nikhilk.net/ScriptSharpIntro.aspx">Script# &#8211; Introduction</a></li>
<li><a href="http://www.microsoft-watch.com/content/developer/script_vs_google_gwt_may_the_best_ajax_tool_win.html">Script# Vs. Google GWT: May the Best Ajax Tool Win</a></li>
<li><a href="http://glazkov.com/blog/agony-of-thousand-puppies/">GWT And Now Script#: The Agony of a Thousand Puppies</a></li>
</ul>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/10/29/script-c-to-javascript-converter&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/10/29/script-c-to-javascript-converter/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>How to protect the image from being copied?</title>
		<link>http://michaelsync.net/2007/08/22/how-to-protect-the-image-from-being-copied</link>
		<comments>http://michaelsync.net/2007/08/22/how-to-protect-the-image-from-being-copied#comments</comments>
		<pubDate>Wed, 22 Aug 2007 17:40:03 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/08/22/how-to-protect-the-image-from-being-copied</guid>
		<description><![CDATA[Well, it is so sad to say that there is no way to protect the images from being copied until the time of writing this post. You may probably tell me that you found a lot of &#8220;Image Protection&#8221; tools...]]></description>
			<content:encoded><![CDATA[<p>Well, <strong>it is so sad to say that there is no way to protect the images from being copied</strong> until the time of writing this post. You may probably tell me that you found a lot of &#8220;Image Protection&#8221; tools on web. Yeah. I know. I did even tried some of them once. Those tools make people difficult to copy the images from your website. but there are always some sort of hecks for copying images. No matter what tools or technologies you use.</p>
<p>I will tell some attempts that people tried to achieve this goal and the reason why those attempts were failed.</p>
<p><strong>#1. Disabling &#8220;Right Click&#8221; on webpage by using Javascript.</strong></p>
<p>This is very very old trick and it&#8217;s totally useless. Don&#8217;t forget &#8220;Save As&#8221; in File menu. Plus, there are a lot of DOM manipulators (eg: Firebug) to track the path of images.</p>
<p><strong>#2. Adding new transparent image over the actual image  </strong></p>
<p>I found some sites (including flickr) that are using this technique to protect their images from being copied. It works for normal users who only knows &#8220;Right Click&#8221; and &#8220;Save Image As&#8221;. You can still check the source to get the correct path of actual image that you want. If you are familiar with firebug, you can easily delete the transparent image that you don&#8217;t want on the fly.</p>
<p><strong>#3.  Using third-part tools for image protection</strong></p>
<p>If you do googling about this a lit bit, you will get a ton of tools advertising that those tools will help you to protect your image from being copied (some even said that those tools are able to protect HTML code too.) Don&#8217;t even never spend your money on those tools. I mean it. As I said above, I tried already. I know those tools are not good enough since they have their own limitations. So, don&#8217;t waste your money on it.</p>
<p>This fact applied for code protection tool also. Those tools are going to encrypt your webpage and will add a lot of whitespace in your actual source. So, if you check the &#8220;View Source&#8221; a lit in your browser, you will see plain text or some text you write instead of HTML code. but don&#8217;t forget to scroll a lit bit.. You will see goddammed things.. and those tools will eat your bandwidth and it made your visitors to view the web page in slow motion. :)</p>
<p><strong>#4. Putting images in Embedded Object (Flash or ActiveX Object)</strong></p>
<p>I think this is the best way to protect the image so far.  but it is possible to download the whole flash file (*.flv) to local machine by using third-party tool or firefox extensions (eg: Download Helper). So, the individual image are safe from being copied but not for flash.</p>
<p><strong>UPDATED (27th August, 2007):  </strong></p>
<p><strong>Watermarking </strong>(Thanks to <strong>mmhan</strong> for reminding me about this.)<strong><br />
</strong></p>
<p>AFAIK, there are two ways of watermarking. The first way is that putting a watermark simply on the image. This watermark will be visible to everybody. The second way is that putting a invisible watermark on the image by using Steganography.</p>
<p>Yeah. those are the ways that I remember how people tried to protect their images. If you have other ways, don&#8217;t hesitate to let me know.</p>
<p>Remember! All images from the webpage are already sent to the temporary internet files of  user&#8217;s local machine before showing to the web browser. So, user can still copying images from Temporary Internet File folder. And, What about &#8220;Print Screen&#8221;? :)</p>
<p>So, if you ask me how to protect the image, I would say &#8220;don&#8217;t do that!&#8221; . :)
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/08/22/how-to-protect-the-image-from-being-copied&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/08/22/how-to-protect-the-image-from-being-copied/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>ASP.NET: DropDown List problem with IE6</title>
		<link>http://michaelsync.net/2007/08/10/aspnet-dropdown-list-problem-with-ie6</link>
		<comments>http://michaelsync.net/2007/08/10/aspnet-dropdown-list-problem-with-ie6#comments</comments>
		<pubDate>Fri, 10 Aug 2007 18:26:37 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/08/10/aspnet-dropdown-list-problem-with-ie6</guid>
		<description><![CDATA[SourceCode Download ~ Hosted by eSnips Question ~ One member from Codeproject asked ~ Hi all, There is a small requirement in drop down list. Suppose I have bounded the employee names to the drop down list. Now I am...]]></description>
			<content:encoded><![CDATA[<p><strong>SourceCode Download ~</strong></p>
<table style="border:1px solid #353535;background-color:#5d7cba;font-family:Arial,Helvetica,sans-serif;font-size:11px;padding:0;" border="0" cellpadding="0" cellspacing="0">
<tr style="background-color:#ffffff;">
<td style="padding:5px;" align="center"><a href="http://www.esnips.com/doc/a4233c36-a9e2-4440-b80f-cb691a6fde68/WebSite7/?widget=documentIcon"><img src="/images/thumbs/thumb.zip.gif" alt="WebSite7" border="0" /></a></td>
</tr>
<tr>
<td style="font-size:9px;color:#ffffff;padding:5px;" valign="bottom">Hosted by <a href="http://www.esnips.com">eSnips</a></td>
</tr>
</table>
<p><strong>Question</strong> ~</p>
<p><a href="http://www.codeproject.com/script/comments/forums.asp?forumid=12076&amp;Page=1&amp;userid=1444452&amp;mode=all&amp;select=2172521&amp;df=100&amp;mpp=50&amp;fr=461#xx2172521xx">One member from Codeproject asked</a> ~</p>
<blockquote><p><font>Hi all,</font></p>
<p><font>There is a small requirement in drop down list. Suppose I have bounded the employee names to the drop down list. Now I am searching for a name “Peter”. So if I press ‘p’ and then ‘e’ it should go to Peter’s name. But it goes to Elizabeth’s name. Is there any solution for that? Could anyone of you please help me on that? I am using .Net version 2.0</font></p>
<p><font>Thanks and Regards,<br />
Hariharan C </font></p></blockquote>
<p><strong>Solution</strong> ~</p>
<p>This issue occurs in Internet Explorer 6 version only. I have tested this issue with the most of browsers (<font>Internet Explorer 7, Firefox 2.0.0.6,  Opera 9.2 and Safari 3.0.3 (Windows).</font>) It works fine except IE6. I looked for the solution and I came up with the following code.</p>
<pre class="brush: jscript; title: ; notranslate">

var pressedKeyString = &quot;&quot;;
var delay = 1000;
var timeID = null;

function move(){
var selectList = document.getElementById('DropDownList1');
var arr = new Array();
var idx = 0;
for(var i = 0; i = pressedKeyString.length){
if(pressedKeyString.toLowerCase() == selectList.options[i].value.substring(0,pressedKeyString.length).toLowerCase()){
selectList.selectedIndex = i;
i=selectList.options.length;
alert(pressedKeyString);
}
}
}
pressedKeyString = &quot;&quot;;
}
function foo(e,id){
if(timeID != null)clearTimeout(timeID);
timeID = setTimeout(&quot;move();&quot;,delay);
var key;
if(window.event) // IE
{
key = e.keyCode
}
else if(e.which) // Netscape/Firefox/Opera
{
key = e.which
}
var pressKey = String.fromCharCode(key);
pressedKeyString += pressKey;
}
</pre>
<p>The main idea of this code is that we will enable the timer to check whether the user is still typing or not. The timer will get clear as long as the user keep on typing. The character that you typed will keep on appending to the string called pressedKeyString. Note that the select list will be changed automatically on IE6 by default while typing. (Ya, this is what we don&#8217;t like). After typing finished (timer will count to 1000 minisecound), then the dropdown list will be changed to the option which is matched with the characters that you enter. (eg: if you type &#8220;pe&#8221; then dropdown list will select to &#8220;Peter&#8221;.)</p>
<p>Hope it helps. Feel free to let me know if you have any comment or suggestion. Thanks.
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/08/10/aspnet-dropdown-list-problem-with-ie6&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/08/10/aspnet-dropdown-list-problem-with-ie6/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Some interesting ASP.NET 2.0 FAQ</title>
		<link>http://michaelsync.net/2007/07/08/some-interesting-aspnet-20-faq</link>
		<comments>http://michaelsync.net/2007/07/08/some-interesting-aspnet-20-faq#comments</comments>
		<pubDate>Sun, 08 Jul 2007 03:54:27 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/07/08/some-interesting-aspnet-20-faq</guid>
		<description><![CDATA[I found this post &#60;I’m wondering &#8211; asp.net 2.0&#62; on Mayvelous&#8217;s blog. I think those questions are very interesting. So, I was thinking to write the reply post for those questions but I didn&#8217;t have the exact answer for the...]]></description>
			<content:encoded><![CDATA[<p>I found this post &lt;<a href="http://www.mayvelous.com/?p=322" target="_blank">I’m wondering &#8211; asp.net 2.0</a><strong>&gt; </strong>on Mayvelous&#8217;s blog<strong>. </strong>I think those questions are very interesting. So, I was thinking to write the reply post for those questions but I didn&#8217;t have the exact answer for the generated xml file of .dll. I didn&#8217;t have time to find about that too. So, the post was saved as a draft in my blog for long time. I accidentally found this post in wp drafts collection yesterday. I made some changes today and post it here..</p>
<p><strong>Why ASP.NET 2.0 website project does not create project file?</strong></p>
<p>In ASP.NET 1.1, the configuration information of project used to store in *.csproj. If it&#8217;s a web project, the URL part is saved in *.webinfo. But it has been changed in ASP.NET 2.0. All of project configuration, path (both absolute part or virtual part) are stored in *.sln file only.</p>
<p><strong>Why ASP.NET 2.0 webproject doesn&#8217;t create .dll file? Where all those code-behinds compiled into? </strong></p>
<p>ASP.NET web pages and code files are dynamically compiled on request for the first time. The compiled resources are cached for next time request. So, no need to generate .dll for webproject. But It&#8217;s not good pratice and nobody won&#8217;t do that on their production server. Once I did it like that to know how bad that is. What I did was that I copied the whole folder of my website from my harddrive and uploaded it in FTP. Then, I tried to browse my website. It was very slow. I didn&#8217;t use any thrid-party components in that website. I think it will be more obviously slow if there are some third-party components used in website.</p>
<p>You should precompile your website if you wanna see *.dll file of your project. As you know, Precompilation is new features of .NET 2.0 which allows developers to precompile the entire website for boosting response time of your website.</p>
<p><strong>Advantages of Precompilation (Ref: MSDN )</strong></p>
<ul>
<li>Faster response time for users, since pages and code files do not have to be compiled the first time they are requested. This is particularly useful on large sites that are updated frequently.</li>
<li>A means to identify compile-time bugs before users see a site.</li>
<li>The ability to create a compiled version of the site that can be deployed to a production server without source code.</li>
</ul>
<p>More Info ~</p>
<ul>
<li><a href="http://msdn2.microsoft.com/en-us/library/ms228015.aspx" title="ASP.NET Web Site Precompilation" target="_blank">ASP.NET Web Site Precompilation</a></li>
<li><a href="http://msdn2.microsoft.com/en-us/library/e22s60h9.aspx" title="File Handling During ASP.NET Precompilation" target="_blank">File Handling During ASP.NET Precompilation</a></li>
</ul>
<p><strong>&gt;&gt;I’m wondering, if we are to deploy it, do we only deploy .aspx and .ascx (front-end) files or have to include code-behind files as well?</strong></p>
<p>not &#8220;have to&#8221; but you can if you want. Like I said above, you can include code-behind files in deployment. but it&#8217;s not good. Precompilation would be the best.</p>
<p><strong>&gt;&gt;I’m wondering, why .pdb files are also included when you add project references to the website project.pdb files</strong></p>
<p>AFAIK, this .pdb file is automatically generated if the Project configuration is set to &#8220;Debug&#8221; Mode. This file is used for storing the debugging information and symbols. Honestly, I dont have that much idea about this file. Please check <a href="http://msdn2.microsoft.com/en-us/library/yd4f8bd1(vs.71).aspx" target="_blank">.pdb file &#8211; MSDN</a> for more info.</p>
<p><strong> &gt;&gt;I’m wondering, do we need to add those .pdb and .xml along with referenced .dll in the deployment.</strong></p>
<p>No. It&#8217;s not required. I&#8217;m sure that it&#8217;s not required to add those files in deployment but I dont know why xml files are generated. So, I have asked about it in <a href="http://www.codeproject.com/script/comments/forums.asp?forumid=1650&amp;select=2118085#xx2118085xx" target="_blank">CodeProject Forum</a>. I got the answer as below from <a href="http://geekswithblogs.net/sdorman/Default.aspx" target="_blank">Scott Dorman</a> in very short time. (Thank you! scott. )</p>
<blockquote><p>The *.xml file is the compiler generated XML documentation file. The contents of this file come from the XML comments in the source code.</p>
<p>The *.pdb file is the debugging symbol file, also generated by the compiler. It contains the debugging &#8220;symbols&#8221; (information) needed by the debugger to be able to match the compiled binary to the source code when you are debugging.</p></blockquote>
<p>&gt;&gt; <strong>I’m wondering, the main difference between asp.net 2.0 web application project and web site project.</strong></p>
<p>AFAIK, asp.net 2.0 web application project is designed for those who wanna keep VS 2003 web project model. But I&#8217;m not very interest to use this since it doesn&#8217;t support in VS 2005 Express Edition. <a href="http://msdn2.microsoft.com/en-us/library/aa730880(VS.80).aspx" title="MSDN &gt;&gt; Introduction to Web Application Projects" target="_blank">Here</a> is the good article about Web Application Project and the differences between Web Application Project and Web Project.</p>
<p><em>Feel free to let me know if you have any comment for those answers. I&#8217;m just sharing in the way that I understand. If you have some more idea about those then feel free to discuss with me. Thanks.</em>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/07/08/some-interesting-aspnet-20-faq&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/07/08/some-interesting-aspnet-20-faq/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Some FAQ from ASP.NET web development</title>
		<link>http://michaelsync.net/2007/05/20/some-faq-from-aspnet-web-development</link>
		<comments>http://michaelsync.net/2007/05/20/some-faq-from-aspnet-web-development#comments</comments>
		<pubDate>Sun, 20 May 2007 17:29:20 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/05/20/some-faq-from-aspnet-web-development</guid>
		<description><![CDATA[Hello! How are you doing? Today, I wanna share with you some of the notes that I have made while I was working in ASP.NET project. I started playing with .NET since September, 2004. I used to face a lot...]]></description>
			<content:encoded><![CDATA[<p>Hello! How are you doing? Today, I wanna share with you some of the notes that I have made while I was working in ASP.NET project. I started playing with .NET since September, 2004. I used to face a lot of problems and have to find the solutions for those problems. I wanna share all of those problems and solutions that I&#8217;ve faced. But unfortunately, I didn&#8217;t remember all of these since I didn&#8217;t make any note in my outlook. Anyway, I&#8217;ll share with you what I have in my mail. Hopefully, you may find it useful.</p>
<p><strong>1. How to invoke/fire JS function after validating of ASP.NET validator?</strong></p>
<p>Use <strong>&#8220;Page.RegisterStartupScript(,)&#8221;</strong> function as below.</p>
<pre class="brush: csharp; title: ; notranslate">
        string strScript   = &quot;&quot;;
        strScript += &quot;function foo(){&quot;;
        strScript += &quot; alert('This is foo!');&quot;;
        strScript += &quot;}&quot;;
        strScript += &quot;&quot;;Page.RegisterStartupScript(&quot;bear&quot;,strScript);
</pre>
<p><strong>2. Is it possible to access the Javascript variable from Server-side?</strong></p>
<p>Follow the steps below if you wanna share something between the client-side script and server-side script.</p>
<ol>
<li>Add Server-side hidden field in your page.</li>
<li>Set the value of Javascript variable to this hidden field by using document.getElementById() function.</li>
<li>then, get the value of that hidden field.</li>
</ol>
<p><em>Note: I used this technique in <a href="http://michaelsync.net/2007/01/01/custom-javascript-dialog/">this sample</a>. You may check it out. </em></p>
<p><strong>3. Why all data from web controls within the disabled panel has been lost during the postback?</strong></p>
<p>It&#8217;s pretty strange. In window-based application, we only need to disable the panel if we want to disable all controls inside this panel. But we can&#8217;t do like that in web development. ASP.NET doesn&#8217;t keep the viewstate of the controls if the panel is disabled so that all data in those controls within disabled panel will be lost during the PoskBack.<br />
<strong>The solution for this problem is that enable or disable each and every controls inside the disabled panel. Enable explicitly.</strong></p>
<p><a href="http://www.4guysfromrolla.com/ScottMitchell.shtml">Scott Mitchell</a> wrote very good article about this problem and solution in this blog.. You may check his article &#8220;Panel Weirdness&#8221; <a href="http://scottonwriting.net/sowblog/posts/1125.aspx">here</a>.</p>
<p><strong>4. How to set the width of textbox in percentage? [esp: for Firefox users.]</strong></p>
<p>This is the problem that I faced when I was developing cross-browser asp.net web application. What happen was that I wanna set the width of a textbox to 100%. So, I set 100% to the width property of textbox in Design Mode. But the style that i set to textbox doesn&#8217;t load in Firefox. It automatically change from 100% to 100. I have no idea why it was happening like that. However, I could come up with the solution for that problem. <strong>The solution is that write the style you want as a CSS class in CSS file and set it to the textbox. </strong></p>
<p><strong>5. I used to get this error &#8220;Access is Denied: Microsoft.Web.UI.Webcontrols&#8221;" very often while running asp.net project from VS.NET IDE.Why?</strong></p>
<p><strong>Solution #1 ~ </strong></p>
<ul>
<li>Stop Indexing Service.</li>
</ul>
<p>[ref: <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;329065">http://support.microsoft.com/default.aspx?scid=kb;en-us;329065</a>]</p>
<p>Details ~</p>
<blockquote><p> If you do not use Index Server on the server, you can disable it. To do so, follow these steps:<br />
1.	Click Start, and then click Services.<br />
2.	Locate Indexing Service from the list of services, and then click Indexing Service Properties from the subform.<br />
3.	On the General tab of the Indexing Service Properties dialog box, in the Startup type drop-down item list, click Disabled.<br />
4.	Click OK.</p>
<p>If you use Index Server, you can exclude the Temporary ASP.NET Files directory from the folders that the Index Server scans. To do so, follow these steps:<br />
1.	Click Start, point to All Programs, point to Administrative Tools, and then click Computer Management.<br />
2.	Expand the Services and Applications node, expand the Indexing Service node, and then expand the System node.<br />
3.	Right-click the Directories folder, point to New, and then click Directory from the subform to open the Add Directory dialog box.<br />
4.	Click Browse, and then locate the Temporary ASP.NET Files directory. You typically find the Temporary ASP.NET files in the following path: c:\\Microsoft.NET\Framework\\Temporary ASP.NET Files<br />
Note is the version of .NET Framework installed on your computer.<br />
5.	Click No under the Include in Index? option buttons.<br />
6.	Click OK to close.<br />
7.	Close the Computer Management dialog box.<br />
8.	Restart the Indexing Services service.</p></blockquote>
<p><strong>Solution #2 ~ </strong></p>
<p>In the web.config file if the tag identity impersonate=&#8221;true&#8221; is added, remove it and see. [Don't ask me why :)] [Ref: <a href="http://">http://vadivel.blogspot.com/2006/06/access-is-denied-microsoftwebuiwebcont.html</a> ]</p>
<p><strong>5. I&#8217;m using EnterpriseLibrary latest version in my ASP.NET project. I used to get this error message &#8220;This schema for this assembly has not been registered with WMI.&#8221; while building my web project. Why?</strong></p>
<p>Solution ~</p>
<ol>
<li>Open up the EnterpriseLibrary.sln and modify the Configuration Properties\Build\Conditional Constants of the EnterpriseLibrary.Common project.</li>
<li>Remove the USEWMI;USEEVENTLOG;USEPERFORMANCECOUNTER constants. By removing these constants, all of the internal Enterprise Library instrumentation will be disabled.</li>
<li>Recompile.</li>
</ol>
<p>Ref : <a href="http://channel9.msdn.com/wiki/default.aspx/Channel9.EnterpriseLibraryFAQ">http://channel9.msdn.com/wiki/default.aspx/Channel9.EnterpriseLibraryFAQ</a></p>
<p><strong>6. Protecting an ASP.NET page against malicious input with ValidateRequest (A potentially dangerous Request.Form value was detected)</strong></p>
<p>When your project is in testing state, you should try to test your application by entering script tag (eg: &lt;script lanague=&#8221;javascript&#8221;&gt;) or HTML tag (eg: &lt;html&gt;&lt;strong&gt;) or #@ or @# characters. And see what happen.. You may probably get the error..<strong> If you don&#8217;t wanna get this error then you have to set the page directive validateRequest to false. <em>Note that your page might has the security problem</em>. </strong></p>
<p>Ref: <a href="http://codebetter.com/blogs/peter.van.ooijen/archive/2005/10/21/133505.aspex">http://codebetter.com/blogs/peter.van.ooijen/archive/2005/10/21/133505.aspex</a></p>
<p>That&#8217;s all for now. If you have any useful tip for ASP.NET development, you can mail me at mchlsync AT gmail.com with the subject &#8220;[Michael Sync's blog - ASP.NET Tips]&#8220;. Thanks a lot.</p>
<p>Related Articles ~</p>
<ol>
<li><a href="http://michaelsync.net/2007/05/13/tipstricks-aspnet-with-sql-reporting-services/">[Tips/Tricks] ASP.NET with SQL Reporting Services</a></li>
<li><a href="http://michaelsync.net/2007/04/04/tipstricks-how-to-control-maxlength-of-multiline-textbox-in-aspnet-11/">Tips/Tricks &#8211; How to control MaxLength of Multiline TextBox in ASP.NET 1.1?</a></li>
</ol>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/05/20/some-faq-from-aspnet-web-development&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/05/20/some-faq-from-aspnet-web-development/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Tips/Tricks] ASP.NET with SQL Reporting Services</title>
		<link>http://michaelsync.net/2007/05/13/tipstricks-aspnet-with-sql-reporting-services</link>
		<comments>http://michaelsync.net/2007/05/13/tipstricks-aspnet-with-sql-reporting-services#comments</comments>
		<pubDate>Sun, 13 May 2007 17:34:32 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/05/13/tipstricks-aspnet-with-sql-reporting-services</guid>
		<description><![CDATA[1. Error Message ~ d:\xxxxx\yourwebproject\yourreport.rdl The value expression used in query parameter ‘@xxx’ returned a data type that is not valid. Solution ~ Remove this parameter from Parameter Rebuild the solution (If you are still getting this error) Close and...]]></description>
			<content:encoded><![CDATA[<p>1.<strong> Error Message</strong> ~ d:\xxxxx\yourwebproject\yourreport.rdl<br />
The value expression used in query parameter ‘@xxx’ returned a data type that is not valid.</p>
<p><strong>Solution </strong>~</p>
<ul>
<li>Remove this parameter from Parameter</li>
<li>Rebuild the solution</li>
<li>(If you are still getting this error) Close and Reopen Visual Studio IDE ***</li>
</ul>
<p align="center">&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</p>
<p>2. <strong>Error Message</strong> ~ Parameter validation failed. It is not possible to provide valid values for all parameters. (rsParameterError) Get Online Help</p>
<p><strong>Solution </strong>~</p>
<ul>
<li>Check &#8220;Has default&#8221; checkedbox in parameter lists of ReportViewer</li>
</ul>
<p align="center">***********</p>
<p>3.<strong> Problem</strong>: Report doesn’t get updated.<strong></p>
<p>Solution ~</strong></p>
<ul>
<li>Add another parameter like “Timestamp” in your viewer.</li>
<li>Pass a timestamp field to your report from code.</li>
</ul>
<p>Note: If you don’t wanna see this parameter &#8220;Timestamp&#8221; in your reportviewer, put blank for this report. (<strong>Be sure that you  have installed all required service packs.</strong>)
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/05/13/tipstricks-aspnet-with-sql-reporting-services&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/05/13/tipstricks-aspnet-with-sql-reporting-services/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

