<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://stuartmanning.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">ASP.NET</title><subtitle type="html" /><id>http://stuartmanning.com/blogs/aspnet/atom.aspx</id><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/default.aspx" /><link rel="self" type="application/atom+xml" href="http://stuartmanning.com/blogs/aspnet/atom.aspx" /><generator uri="http://communityserver.org" version="3.1.20917.1142">Community Server</generator><updated>2008-03-27T11:35:00Z</updated><entry><title>NIMTUG - The Best of the PDC </title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/11/26/nimtug-the-best-of-the-pdc.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/11/26/nimtug-the-best-of-the-pdc.aspx</id><published>2008-11-26T15:45:00Z</published><updated>2008-11-26T15:45:00Z</updated><content type="html">&lt;p&gt;The next NIMTUG event has been annouced.. registration for the event can be found using the link below.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://nimtug.org/events/61/default.aspx"&gt;http://nimtug.org/events/61/default.aspx&lt;/a&gt;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br /&gt;Didn’t make it to the PDC in Los Angeles this year? Feeling overwhelmed by all the developments and announcements that went on that week? You’re not alone! Come join NIMTUG for rePDC, and you’ll learn all about the best of the best including Azure, Windows 7, Oslo the modelling platform, the new Silverlight Toolkit, Windows Live Framework announcements, OpenID support, VS2010 and .NET 4.0 and much more. We’ll have a look at what’s available now from the new platforms and where and how to get started.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Details&lt;br /&gt;&lt;/strong&gt;Monday, 01 Dec 2008, 19:30 to 21:30&lt;br /&gt;Cost: Free&lt;br /&gt;Contact: &lt;a href="mailto:admin@nimtug.org"&gt;admin@nimtug.org&lt;/a&gt;&lt;br /&gt;Note: There will be a reception after the event&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Location&lt;/strong&gt;&lt;br /&gt;Wellington Park Hotel &lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.wellingtonparkhotel.com/"&gt;http://www.wellingtonparkhotel.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;21 Malone Road&lt;br /&gt;Belfast&lt;br /&gt;BT9 6RU &lt;br /&gt;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=72" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="Belfast" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Belfast/default.aspx" /><category term="NIMTUG" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/NIMTUG/default.aspx" /><category term="PDC" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/PDC/default.aspx" /></entry><entry><title>Uploading Large Files - IIS 7</title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/11/14/uploading-large-files-iis-7.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/11/14/uploading-large-files-iis-7.aspx</id><published>2008-11-14T09:42:00Z</published><updated>2008-11-14T09:42:00Z</updated><content type="html">&lt;p&gt;Haveing a problem with large file uploads on IIS7. Are you finding that regardless of what you do the&amp;nbsp; &amp;lt;httpRuntime&amp;gt; setting are being ignored? Well I did and here&amp;#39;s the anser - thanks to a Telerik article. &lt;/p&gt;
&lt;p&gt;Note that this does not require the &amp;quot;RadUpload&amp;quot; component to work - as featured in the&amp;nbsp; original article.&lt;br /&gt;&lt;a href="http://www.telerik.com/help/aspnet-ajax/upload_uploadinglargefiles.html"&gt;http://www.telerik.com/help/aspnet-ajax/upload_uploadinglargefiles.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[Web.config] Web.config settings for 100MB and 1 hour&lt;br /&gt;&lt;/strong&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;...&lt;br /&gt;&amp;lt;system. web&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;httpRuntime maxRequestLength=&amp;quot;102400&amp;quot; executionTimeout= &amp;quot;3600&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp; ...&lt;br /&gt;&amp;lt;/system .web&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Settings for IIS7&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Add these lines in the web.config file: &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[Web.config] maxAllowedContentLength attribute for IIS7&lt;/strong&gt;&amp;nbsp; &lt;br /&gt;&amp;lt;system.webServer&amp;gt;&lt;br /&gt;...&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;security &amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;requestFiltering&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;requestLimits maxAllowedContentLength=&amp;quot;1024000000&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/requestFiltering&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/security&amp;gt;&lt;br /&gt;&amp;lt;/system.webServer&amp;gt; &lt;/p&gt;
&lt;p&gt;Open the file C:\Windows\System32\inetsrv\config\applicationHost.config and find the line:&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Set the overrideModeDefault property to Allow. &lt;br /&gt;&amp;lt;section name=&amp;quot;requestFiltering&amp;quot; overrideModeDefault=&amp;quot;Allow&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=67" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="ASP.NET" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/ASP.NET/default.aspx" /><category term="upload" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/upload/default.aspx" /><category term="large file upload" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/large+file+upload/default.aspx" /></entry><entry><title>Google GeoCoder for ASP.NET C# - Latitude, Longitude, Address &amp; Reverse GeoCode</title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/11/07/google-geocoder-for-asp-net-c-latitude-longitude-address-amp-reverse-geocode.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/11/07/google-geocoder-for-asp-net-c-latitude-longitude-address-amp-reverse-geocode.aspx</id><published>2008-11-07T02:30:00Z</published><updated>2008-11-07T02:30:00Z</updated><content type="html">&lt;p&gt;Google GeoCoder for ASP.NET C# is a sample code example for look up an address and return the latitude and longitude. &lt;/p&gt;
&lt;p&gt;Reverse look-up can be achieved by clicking on the map.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://stuartmanning.com/demo/GoogleGeoCoder/Default.aspx"&gt;Demo [using MicrosoftAjax.js]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://stuartmanning.com/demo/GoogleGeoCoder/Jquery.aspx"&gt;Demo [using JQuery]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Download Source @ CodePlex &lt;a href="http://www.codeplex.com/GoogleGeoCoder"&gt;http://www.codeplex.com/GoogleGeoCoder&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=66" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="AJAX" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/AJAX/default.aspx" /><category term="ASP.NET" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/ASP.NET/default.aspx" /><category term="ASP.NET AJAX" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/ASP.NET+AJAX/default.aspx" /><category term="Javascript" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Javascript/default.aspx" /><category term="Client Side Library" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Client+Side+Library/default.aspx" /><category term="C#" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/C_2300_/default.aspx" /><category term="Google Geocoding" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Google+Geocoding/default.aspx" /><category term="Reverse Geocoding" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Reverse+Geocoding/default.aspx" /></entry><entry><title>Convert html image to cid - Embedding email images on the fly.</title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/07/21/convert-html-image-to-cid-embedding-email-images-on-the-fly.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/07/21/convert-html-image-to-cid-embedding-email-images-on-the-fly.aspx</id><published>2008-07-21T22:55:00Z</published><updated>2008-07-21T22:55:00Z</updated><content type="html">&lt;p&gt;Ever needed to convert html image link on your site to cid&amp;nbsp;to embed on&amp;nbsp;email&lt;/p&gt;
&lt;p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; ArrayList arr_image_path &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; ArrayList();&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//image array (for embedding images)&lt;/span&gt;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; _html, _plain;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; RootDirectory &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; HttpRuntime.AppDomainAppPath.ToString();



&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;void&lt;/span&gt; covert_image_to_embedded_cid()
    {
        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;int&lt;/span&gt; cid &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; 0;


        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; Pattern &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;@"url\(['|\""]+.*['|\""&lt;/span&gt;]\)|src=[&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;""&lt;/span&gt;&lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;|&lt;/span&gt;'][^&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;""&lt;/span&gt;']&lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt;[&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;""&lt;/span&gt;&lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;|&lt;/span&gt;']&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;";


        MatchCollection match_vars = Regex.Matches(_html, Pattern,
                                        RegexOptions.IgnoreCase);


        string img_path;


        foreach (Match match in match_vars)
        {


            _html = _html.Replace(match.Value, "&lt;/span&gt;src=\&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"cid:EmbedRes_"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; cid &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"\""&lt;/span&gt;);


            &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//get path;&lt;/span&gt;
            img_path &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; Regex.Replace(match.Value, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;@"url\(['|\""]"&lt;/span&gt;, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;""&lt;/span&gt;);
            img_path &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; Regex.Replace(img_path, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;@"src=['|\""]"&lt;/span&gt;, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;""&lt;/span&gt;);
            img_path &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; Regex.Replace(img_path, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;@"['|\""]\)"&lt;/span&gt;, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;""&lt;/span&gt;).Replace(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"\""&lt;/span&gt;, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;""&lt;/span&gt;);



            arr_image_path.Add(img_path);
            cid++;
        }


    }


&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;bool&lt;/span&gt; sendmail(&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; strTo, &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; strSubject)
    {


        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;bool&lt;/span&gt; success &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;false&lt;/span&gt;;


        StringBuilder sb_plain &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; StringBuilder();
        StringBuilder sb_html &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; StringBuilder();


        &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//create the mail message&lt;/span&gt;
        MailMessage mail &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; MailMessage();


        &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//set the addresses&lt;/span&gt;
        mail.From &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; MailAddress(Mail_From);


        mail.To.Add(strTo);


        &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//set the content&lt;/span&gt;
        mail.Subject &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; strSubject;


        &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//Plain Text&lt;/span&gt;
        AlternateView plainView &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; AlternateView.CreateAlternateViewFromString(_plain, &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;null&lt;/span&gt;, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"text/plain"&lt;/span&gt;);


        &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//Html part&lt;/span&gt;
        AlternateView htmlView &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; AlternateView.CreateAlternateViewFromString(_html, &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;null&lt;/span&gt;, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"text/html"&lt;/span&gt;);
        mail.AlternateViews.Add(plainView);
        mail.AlternateViews.Add(htmlView);


        &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//add images&lt;/span&gt;
        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt; (arr_image_path.Count &amp;gt; 0)
        {
            &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;for&lt;/span&gt;(&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;int&lt;/span&gt; i=0; i&amp;lt;arr_image_path.Count; i++)
            {
                &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; img &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; arr_image_path[i].ToString();


                &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt; (!img.ToLower().StartsWith(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"http"&lt;/span&gt;))
                {
                    img &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; RootDirectory &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; img;
                }
                LinkedResource logo &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; LinkedResource(img);
                logo.ContentId &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"EmbedRes_"&lt;/span&gt;+i;
                htmlView.LinkedResources.Add(logo);
            }
        }


 



        &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//send the message&lt;/span&gt;
        SmtpClient smtp &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; SmtpClient(MailServer); &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//specify the mail server address&lt;/span&gt;


        &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//check if server creditial required&lt;/span&gt;


        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt; (credentialsRequired)
        {
            smtp.Credentials &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; NetworkCredential(Mail_Username, Mail_Password);


        }


        &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//try&lt;/span&gt;
        {


            smtp.Send(mail);
        }
        &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//catch&lt;/span&gt;
        {


        }


 


        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;return&lt;/span&gt; success;
    }
 &lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=52" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="ASP.NET" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/ASP.NET/default.aspx" /><category term="code" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/code/default.aspx" /><category term="email" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/email/default.aspx" /><category term="C#" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/C_2300_/default.aspx" /></entry><entry><title>Call asp:updatepanel from Javascript</title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/07/20/call-asp-updatepanel-from-javascript.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/07/20/call-asp-updatepanel-from-javascript.aspx</id><published>2008-07-20T22:44:00Z</published><updated>2008-07-20T22:44:00Z</updated><content type="html">&lt;p&gt;Javascript&lt;/p&gt;
&lt;p&gt;__doPostBack (&amp;#39;UpdatePanel1&amp;#39;, &amp;#39;&amp;#39;);&lt;/p&gt;
&lt;p&gt;If your using UserControls the ClientId can be harder to find. &lt;/p&gt;
&lt;p&gt;Inline .aspx Javascript&lt;/p&gt;
&lt;p&gt;__doPostBack(&amp;#39;&amp;lt;%= UpdatePanel1.ClientID =%&amp;gt;&amp;#39;, &amp;#39;&amp;#39;);&lt;/p&gt;
&lt;p&gt;or &lt;/p&gt;
&lt;p&gt;var panel = &amp;#39;&amp;lt;%= UpdatePanel1.ClientID =%&amp;gt;&amp;#39;&lt;/p&gt;
&lt;p&gt;__doPostBack(panel, &amp;#39;&amp;#39;);&lt;/p&gt;
&lt;p&gt;A super article can be found at &lt;/p&gt;
&lt;p&gt;&lt;a href="http://encosia.com/2007/07/13/easily-refresh-an-updatepanel-using-javascript"&gt;http://encosia.com/2007/07/13/easily-refresh-an-updatepanel-using-javascript&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=50" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="AJAX" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/AJAX/default.aspx" /><category term="ASP.NET" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/ASP.NET/default.aspx" /><category term="Javascript" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Javascript/default.aspx" /><category term="C#" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/C_2300_/default.aspx" /><category term="updatepanel" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/updatepanel/default.aspx" /></entry><entry><title>Large File upload. SwfUpload &amp; C#</title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/07/19/large-file-upload-swfupload-amp-c.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/07/19/large-file-upload-swfupload-amp-c.aspx</id><published>2008-07-19T22:31:00Z</published><updated>2008-07-19T22:31:00Z</updated><content type="html">&lt;p&gt;Follow up to &lt;a href="http://stuartmanning.com/blogs/ajax/archive/2008/07/19/swfupload-asp-net-flash-uploader.aspx"&gt;SwfUpload - ASP.NET Flash uploader&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;SwfUpload works by placing a simple 1x1px flash application onto the page, which is highly degradable. The C# example on the main site only works with single uploads at the time of writing. So below is a quick adaption of to get the multiple large file uploader working.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.swfupload.com/"&gt;www.swfupload.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://swfupload.org/project/asp_net"&gt;http://swfupload.org/project/asp_net&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Because we use a JavaScript detection routine to select &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Default.aspx - JavaScript&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;script src=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"jquery-1.2.3.pack.js"&lt;/span&gt; type=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"text/javascript"&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;


&amp;lt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;link&lt;/span&gt; href=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"/swfupload/css/custom.css"&lt;/span&gt; rel=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"stylesheet"&lt;/span&gt; type=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"text/css"&lt;/span&gt; /&amp;gt;
&amp;lt;script type=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"text/javascript"&lt;/span&gt; src=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"/swfupload/swfupload.js"&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"text/javascript"&lt;/span&gt; src=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"/swfupload/js/swfupload.graceful_degradation.js"&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"text/javascript"&lt;/span&gt; src=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"/swfupload/js/swfupload.queue.js"&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"text/javascript"&lt;/span&gt; src=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"/swfupload/js/fileprogress.js"&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"text/javascript"&lt;/span&gt; src=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"/swfupload/js/handlers.js"&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"text/javascript"&lt;/span&gt;&amp;gt;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;var&lt;/span&gt; upload1


window.onload &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;function&lt;/span&gt;() {
upload1 &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; new SWFUpload({
&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// Backend Settings&lt;/span&gt;
upload_url: &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"../../upload.aspx"&lt;/span&gt;,&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// Relative to the SWF file&lt;/span&gt;
                post_params : {
                    &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"ASPSESSID"&lt;/span&gt; : &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"&amp;lt;%=Session.SessionID %&amp;gt;"&lt;/span&gt;
                },


&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// File Upload Settings&lt;/span&gt;
file_size_limit : &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"102400"&lt;/span&gt;,&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// 100MB&lt;/span&gt;
file_types : &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"*.*"&lt;/span&gt;,
file_types_description : &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"All Files"&lt;/span&gt;,
file_upload_limit : &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"0"&lt;/span&gt;,
file_queue_limit : &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"0"&lt;/span&gt;,


&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// Event Handler Settings (all my handlers are in the Handler.js file)&lt;/span&gt;
file_dialog_start_handler : fileDialogStart,
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,


&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// Flash Settings&lt;/span&gt;
flash_url : &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"/assets/swfupload/swfupload_f8.swf"&lt;/span&gt;,&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// Relative to this file (or you can use absolute paths)&lt;/span&gt;


swfupload_element_id : &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"flashUI1"&lt;/span&gt;,&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// Setting from graceful degradation plugin&lt;/span&gt;
degraded_element_id : &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"degradedUI1"&lt;/span&gt;,&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// Setting from graceful degradation plugin&lt;/span&gt;


custom_settings : {
progressTarget : &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"fsUploadProgress1"&lt;/span&gt;,
cancelButtonId : &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"btnCancel1"&lt;/span&gt;
},


&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// Debug Settings&lt;/span&gt;
debug: false
});



     }
&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Default.aspx - body&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;div&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;id&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="uploader"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;style&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="display:none"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;
    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;div&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;id&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="flashUI1"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;style&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="display: none;"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;
     &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;fieldset&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;class&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="flash"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;id&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="fsUploadProgress1"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;
     &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;legend&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;File Upload&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;legend&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;
     &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;fieldset&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;
     &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;div&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;
      &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;input&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;type&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="button"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;value&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="Upload file (Max 100 MB)"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;onclick&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="upload1.selectFiles()"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;style&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="font-size: 8pt;"&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;input&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;id&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="btnCancel1"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;type&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="button"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;value&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="Cancel Uploads"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;onclick&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="cancelQueue(upload1);"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;disabled&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="disabled"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;style&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="font-size: 8pt;"&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;br&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;/&amp;gt;&lt;/span&gt;
     &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;div&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;
    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;div&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;
    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;div&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;id&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="degradedUI1"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;
     Flash 8 or greater is required.
Note: can place standard asp:FileUploader here.
    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;div&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;div&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Uploader.aspx&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;                         
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; HttpPostedFile posted_file;


    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;private&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;static&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; RootDirectory &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; HttpRuntime.AppDomainAppPath.ToString();


    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; folder &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"/images/"&lt;/span&gt;;


    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; filename;


    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;protected&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;object&lt;/span&gt; sender, EventArgs e)
    {


        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;try&lt;/span&gt;
        {
            posted_file &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; Request.Files[&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"Filedata"&lt;/span&gt;];
            &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; destination_folder &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; RootDirectory &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; folder;


            posted_file.SaveAs(destination_folder &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; unique_filename(posted_file.FileName, destination_folder));


            Response.StatusCode &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; 200;


        }
        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;catch&lt;/span&gt;
        {
            &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// If any kind of error occurs return a 500 Internal Server error&lt;/span&gt;
            Response.StatusCode &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; 500;
            Response.Write(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"An error occured"&lt;/span&gt;);
            Response.End();
        }
        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;finally&lt;/span&gt;
        {
            &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// Clean up&lt;/span&gt;


        }
    }


&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//Unique filename GetRandomFileName function&lt;/span&gt;


    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; unique_filename(&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; filename, &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; folder)
    {


        filename &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; Path.GetFileNameWithoutExtension(Path.GetRandomFileName()) &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt;
        Path.GetExtension(orginal_file_name).ToLower();


        Boolean exists &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;true&lt;/span&gt;;


        &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//check if exists&lt;/span&gt;
        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt; (File.Exists(folder &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; filename))
        {
            &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;while&lt;/span&gt; (exists)
            {
                &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt; (File.Exists(folder &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; filename))
                {
                    exists &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;false&lt;/span&gt;;
                }
                &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;else&lt;/span&gt;
                {
                    filename &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; Path.GetFileNameWithoutExtension(Path.GetRandomFileName()) &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt;
                    Path.GetExtension(orginal_file_name).ToLower();
                }
            }
        }


        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;return&lt;/span&gt; filename;


    }&lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Uploader will return custom 500 message if required straight back to the main page.&lt;br /&gt;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=49" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="AJAX" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/AJAX/default.aspx" /><category term="ASP.NET" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/ASP.NET/default.aspx" /><category term="css" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/css/default.aspx" /><category term="Javascript" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Javascript/default.aspx" /><category term="C#" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/C_2300_/default.aspx" /><category term="upload" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/upload/default.aspx" /><category term="file uploader" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/file+uploader/default.aspx" /><category term="large file" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/large+file/default.aspx" /><category term="Flash" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Flash/default.aspx" /><category term="swfupload" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/swfupload/default.aspx" /></entry><entry><title>ASP.NET: Restrict Dimensions While Uploading Images With The FileUpload Control</title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/07/18/asp-net-restrict-dimensions-while-uploading-images-with-the-fileupload-control.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/07/18/asp-net-restrict-dimensions-while-uploading-images-with-the-fileupload-control.aspx</id><published>2008-07-18T22:27:00Z</published><updated>2008-07-18T22:27:00Z</updated><content type="html">&lt;p&gt;Nice article on how to restrict image width &amp;amp; height when uploading&lt;br /&gt;&lt;a href="http://dotnetdiscussion.net/2007/11/27/aspnet-restrict-dimensions-while-uploading-images-with-the-fileupload-control"&gt;http://dotnetdiscussion.net/2007/11/27/aspnet-restrict-dimensions-while-uploading-images-with-the-fileupload-control&lt;/a&gt;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=47" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="C#" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/C_2300_/default.aspx" /><category term="image" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/image/default.aspx" /><category term="image upload" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/image+upload/default.aspx" /><category term="gdi" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/gdi/default.aspx" /></entry><entry><title>Linq to XML</title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/07/18/linq-to-xml.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/07/18/linq-to-xml.aspx</id><published>2008-07-18T22:26:00Z</published><updated>2008-07-18T22:26:00Z</updated><content type="html">&lt;p&gt;Linq to XML in 3 easy steps&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dev102.com/2008/04/25/linq-to-xml-in-3-easy-steps"&gt;http://www.dev102.com/2008/04/25/linq-to-xml-in-3-easy-steps&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Linq to XML - Adding, Updating and Deleting Data&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/maordavid/archive/2007/10/13/linq-to-xml-adding-updating-and-deleting-data.aspx"&gt;http://blogs.microsoft.co.il/blogs/maordavid/archive/2007/10/13/linq-to-xml-adding-updating-and-deleting-data.aspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=46" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="LINQ" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/LINQ/default.aspx" /><category term="LINQ to XML" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/LINQ+to+XML/default.aspx" /><category term="C#" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/C_2300_/default.aspx" /><category term="xml" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/xml/default.aspx" /></entry><entry><title>Accessing a Hyperlink (or other server control) inside a usercontrol - Custom Server Control Example for JavaScript reference </title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/07/18/accessing-a-hyperlink-or-other-server-control-inside-a-usercontrol-custom-server-control-example-for-javascript-reference.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/07/18/accessing-a-hyperlink-or-other-server-control-inside-a-usercontrol-custom-server-control-example-for-javascript-reference.aspx</id><published>2008-07-17T23:22:00Z</published><updated>2008-07-17T23:22:00Z</updated><content type="html">&lt;p&gt;Need to shorten a server control ClientId to be accessible from JavaScript. This example creates a custom hyperlink control with shorted ClientID sans control id.&lt;/p&gt;
&lt;p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;using&lt;/span&gt; System;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;using&lt;/span&gt; System.ComponentModel;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;using&lt;/span&gt; System.Security.Permissions;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;using&lt;/span&gt; System.Web;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;using&lt;/span&gt; System.Web.UI;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;using&lt;/span&gt; System.Web.UI.WebControls;


&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;/// Summary description for hyperlink&lt;/span&gt;
&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;/// &lt;/span&gt;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;namespace&lt;/span&gt; Gasta.CustomControl
{


    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;class&lt;/span&gt; href : HyperLink
    {


        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;override&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; ClientID
        {
            get
            {
                &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;return&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;this&lt;/span&gt;.ID;
            }
        }
    }
}



 &lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Web.config&lt;/strong&gt; &amp;lt;- add&lt;/p&gt;
&lt;p&gt;&amp;lt;pages&amp;gt;&lt;br /&gt;&amp;lt;add tagPrefix=&amp;quot;custom&amp;quot; namespace=&amp;quot;My.CustomControl&amp;quot;&amp;gt;&amp;lt;/add&amp;gt;&lt;br /&gt;&amp;lt;/pages&amp;gt; &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;ASPX&lt;br /&gt;&lt;/strong&gt;&amp;lt;custom:href runat=&amp;quot;server&amp;quot; id=&amp;quot;li_nav_web&amp;quot; href=&amp;quot;/Default.aspx&amp;quot; mce_href=&amp;quot;/Default.aspx&amp;quot;&amp;gt;Web&amp;lt;/custom:href&amp;gt;&amp;lt;/h1&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/yhzc935f.aspx"&gt;http://msdn.microsoft.com/en-us/library/yhzc935f.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blog.danbartels.com/archive/2005/11/11/1110.aspx"&gt;http://blog.danbartels.com/archive/2005/11/11/1110.aspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=55" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="ASP.NET" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/ASP.NET/default.aspx" /><category term="code" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/code/default.aspx" /><category term="Javascript" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Javascript/default.aspx" /><category term="C#" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/C_2300_/default.aspx" /><category term="custom control" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/custom+control/default.aspx" /></entry><entry><title>Programmatically creating an IIS7 site</title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/07/18/programmatically-creating-an-iis7-site.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/07/18/programmatically-creating-an-iis7-site.aspx</id><published>2008-07-17T23:13:00Z</published><updated>2008-07-17T23:13:00Z</updated><content type="html">&lt;p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;using&lt;/span&gt; Microsoft.Web.Administration;


&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; url &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"mysite.com"&lt;/span&gt;;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; sitename &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"mysite"&lt;/span&gt;;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; ip_address &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"128.0.1.100"&lt;/span&gt;;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; folder &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"c"&lt;/span&gt;;


&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;protected&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;void&lt;/span&gt; create_iis_instance()
    {
        
            &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; app_site &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; sitename.Replace(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"\\"&lt;/span&gt;,&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"_"&lt;/span&gt;);
            app_site &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; sitename.Replace(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"/"&lt;/span&gt;, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"_"&lt;/span&gt;);
            ServerManager serverMgr &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; ServerManager();
            Site mySite &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; serverMgr.Sites.Add(sitename, folder, 80);
            mySite.Bindings.Clear();


            &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;string&lt;/span&gt; bind &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; ip_address &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;":"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; 80 &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;":"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; url


            Binding binding &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; mySite.Bindings.CreateElement();


            binding.Protocol &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"http"&lt;/span&gt;;


            binding.BindingInformation &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; bind;


            mySite.Bindings.Add(binding);           


            serverMgr.ApplicationPools.Add(app_site);
            mySite.ApplicationDefaults.ApplicationPoolName &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; app_site;
            &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;/*mySite.TraceFailedRequestsLogging.Enabled = true;
            mySite.TraceFailedRequestsLogging.Directory = "C:\\inetpub\\customfolder\\site";*/&lt;/span&gt;
            serverMgr.CommitChanges();
    }&lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=54" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="code" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/code/default.aspx" /><category term="IIS7" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/IIS7/default.aspx" /></entry><entry><title>Loading UserControl Dynamically in UpdatePanel </title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/07/18/loading-usercontrol-dynamically-in-updatepanel.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/07/18/loading-usercontrol-dynamically-in-updatepanel.aspx</id><published>2008-07-17T23:03:00Z</published><updated>2008-07-17T23:03:00Z</updated><content type="html">&lt;p&gt;Good article on the above&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geekswithblogs.net/rashid/archive/2007/08/11/Loading-UserControl-Dynamically-in-UpdatePanel.aspx"&gt;http://geekswithblogs.net/rashid/archive/2007/08/11/Loading-UserControl-Dynamically-in-UpdatePanel.aspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=53" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="AJAX" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/AJAX/default.aspx" /><category term="updatepanel" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/updatepanel/default.aspx" /><category term="usercontrols" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/usercontrols/default.aspx" /></entry><entry><title>Regular Expression Generator</title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/07/17/regular-expression-generator.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/07/17/regular-expression-generator.aspx</id><published>2008-07-17T22:23:00Z</published><updated>2008-07-17T22:23:00Z</updated><content type="html">&lt;p&gt;Life just got easier. Try &lt;a href="http://www.txt2re.com/"&gt;http://www.txt2re.com&lt;/a&gt; a superb regular expression generator. Generates code in C#, as well as VB, C++, ruby and more.&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="http://www.txt2re.com/index-csharp.php3?s=[sender_name]%20[sender_company]%20[sender_email]%20has%20sent%20you%20the%20following%20images%20for%20you%20to%20preview&amp;amp;-126&amp;amp;8&amp;amp;-132"&gt;Quick Example.&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=45" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="Regular Expressions" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Regular+Expressions/default.aspx" /><category term="C#" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/C_2300_/default.aspx" /><category term="Generator" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Generator/default.aspx" /></entry><entry><title>Client Side problem with maximum characters for multiline asp:textbox</title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/04/09/asp-textbox-client-side-problem-with-maximum-characters.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/04/09/asp-textbox-client-side-problem-with-maximum-characters.aspx</id><published>2008-04-09T10:01:00Z</published><updated>2008-04-09T10:01:00Z</updated><content type="html">&lt;p&gt;I was asked recently as to how best handle client side cut &amp;amp; pastes using asp:textbox. The main problem was when the TextMode is set to multiline the MaxLenght parameter is ignored.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Client side: JavaScript solution&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;function&lt;/span&gt; textCounter(field, countfield, maxlimit) 
{
  &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;var&lt;/span&gt; thisfield &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; $get(field);
  &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;var&lt;/span&gt; counter &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; $get(countfield);
  
   &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt; (thisfield.value.&lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;length&lt;/span&gt; &amp;gt; maxlimit)
        thisfield.value &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; thisfield.value.&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;substring&lt;/span&gt;(0, maxlimit);
    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;else&lt;/span&gt;
        counter.innerHTML &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; maxlimit &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;-&lt;/span&gt; thisfield.value.&lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;length&lt;/span&gt;;
}&lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Notice $get. This is the dom equivelent to document.getElementById courtsey of the asp.net ajax javascript client library. http://asp.net/AJAX/Documentation/Live/ClientReference/Global/GetShortCutMethod.aspx &lt;/p&gt;
&lt;p&gt;$get is interchangable with document.getElementById.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Client&amp;nbsp; side: ASP.NET&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;asp:TextBox&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="txt_headline"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;MaxLength&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="50"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;TextMode&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="MultiLine"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ToolTip&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="Please enter only 50 chars"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Width&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="300px"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;


&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;span&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;id&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="count_headline"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;style&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="font-weight: bold"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;50&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;span&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt; characters&lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To get this code working we need to bind the form attributes onKeyDown, onKeyUp, onChange&lt;/p&gt;
&lt;p&gt;Importantly, we use onChange to catch our paste function&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Server Side C#&lt;/b&gt;&lt;/p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;protected&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;object&lt;/span&gt; sender, EventArgs e) 


{


      textcounter(); &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//call to bind attributes&lt;/span&gt;


}


&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;private&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;void&lt;/span&gt; textcounter()


    {


        &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;//validation&lt;/span&gt;


        txt_headline.Attributes.Add(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"onKeyDown"&lt;/span&gt;, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"j a v a s c r i p t:textCounter('"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; txt_headline.ClientID &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"', 'count_headline', 50);"&lt;/span&gt;);


        txt_headline.Attributes.Add(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"onKeyUp"&lt;/span&gt;, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"j a v a s c r i p t:textCounter('"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; txt_headline.ClientID &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"', 'count_headline', 50);"&lt;/span&gt;);


        txt_headline.Attributes.Add(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"onChange"&lt;/span&gt;, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"j a v a s c r i p t:textCounter('"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; txt_headline.ClientID &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"', 'count_headline', 50);"&lt;/span&gt;);      


    }&lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Please replace j a v a s c r i p t with javascript in above example&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now, when we run our colution we will have a text counter &amp;amp; we will also capture paste events to lock out string longer than we require. We are capturing the changes after KeyDown, KeyUp and importantly OnChange (cut &amp;amp; paste)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;u&gt;Futher enchancements&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;By default, when I create a simple form I would expressively as validation&lt;/p&gt;
&lt;p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;b&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;


&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;asp:TextBox&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="txt_headline"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;MaxLength&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="50"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;TextMode&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="MultiLine"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ToolTip&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="Please enter only 50 chars"&lt;/span&gt;


                            &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Width&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="300px"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;


                        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;span&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;id&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="count_headline"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;style&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="font-weight: bold"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;50&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;span&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt; characters&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;asp:RequiredFieldValidator&lt;/span&gt;


                            &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="RequiredFieldValidator1"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ControlToValidate&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="txt_headline"&lt;/span&gt;


                            &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Display&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="Dynamic"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ErrorMessage&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="&amp;lt;br /&amp;gt;Headline Required!"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;


                        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;asp:RegularExpressionValidator&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="RegularExpressionValidator3"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ControlToValidate&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="txt_headline"&lt;/span&gt;


                            &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Display&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="Dynamic"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ErrorMessage&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="&amp;lt;br /&amp;gt;Headline cannot contain &amp;lt; or &amp;gt;"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ValidationExpression&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="[^&amp;lt;&amp;gt;]*"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;To enrich this solution for simple form why not use ValidatorCallOutExtender as documented &lt;/p&gt;
&lt;p&gt;http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ValidatorCallout/ValidatorCallout.aspx&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;asp:RegularExpressionValidator&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="RegularExpressionValidator1"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ControlToValidate&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="txt_headline"&lt;/span&gt;  &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Display&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="Dynamic"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ErrorMessage&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="&amp;lt;br /&amp;gt;Headline cannot contain &amp;lt; or &amp;gt;"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ValidationExpression&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="[^&amp;lt;&amp;gt;]*"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;


&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: Maroon;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;cc1:ValidatorCalloutExtender&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="txt_headline "&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;TargetControlID&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;="RequiredFieldValidator1"&lt;/span&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This requires the use of the AjaxControlKit to be added to you project, and brings much of the rich form interaction we have come to expect. &lt;/p&gt;
&lt;p&gt;This article, however does not exclude the idea of good server side validation. Never expect that your user relies on JavaScript to validate. Personally I add universal validation to my entity class saving the labourous task of repeatitly importing/writing validation routines. But that is for another blog.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=41" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="ASP.NET" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/ASP.NET/default.aspx" /><category term="code" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/code/default.aspx" /><category term="Javascript" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Javascript/default.aspx" /><category term="asp:textbox" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/asp_3A00_textbox/default.aspx" /></entry><entry><title>Windows Server 2008 &amp; IIS7 - Live Project</title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/04/01/windows-server-2008-amp-iis7-live-project.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/04/01/windows-server-2008-amp-iis7-live-project.aspx</id><published>2008-04-01T15:17:00Z</published><updated>2008-04-01T15:17:00Z</updated><content type="html">&lt;p&gt;Just a quick note that I have started on pilot of Windows Server 2008 &amp;amp; IIS. Installation in test server was extremely easy and by default old IIS projects where migrated on launch. Installation was &amp;lt; 30 mins. &lt;/p&gt;
&lt;p&gt;Addition of .NET 3.0 and IIS from user environment was a breeze, and IIS immediately imported my test site from previous test server with no questions asked.&lt;/p&gt;
&lt;p&gt;&lt;img height="588" alt="IIS7" src="http://www.stuartmanning.com/images/iis7.jpg" width="960" border="0" /&gt;&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=38" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="Windows Server 2008" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/Windows+Server+2008/default.aspx" /><category term="IIS7" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/IIS7/default.aspx" /></entry><entry><title>AjaxToolkit - problems rendering in VS2008 - eg. TabContainer</title><link rel="alternate" type="text/html" href="http://stuartmanning.com/blogs/aspnet/archive/2008/03/27/ajaxtoolkit-problems-rendering-in-vs2008-eg-tabcontainer.aspx" /><id>http://stuartmanning.com/blogs/aspnet/archive/2008/03/27/ajaxtoolkit-problems-rendering-in-vs2008-eg-tabcontainer.aspx</id><published>2008-03-27T11:35:00Z</published><updated>2008-03-27T11:35:00Z</updated><content type="html">&lt;p&gt;Never fear, if you like me are having a few problems with the AjaxControl toolkit after installing the VS2008 hotfix, then you can still get VS2005 express editions @ &lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/express/aa975050.aspx"&gt;http://msdn2.microsoft.com/en-us/express/aa975050.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Link provides downloads for complete express range and required SP1 where required&lt;/p&gt;&lt;img src="http://stuartmanning.com/aggbug.aspx?PostID=36" width="1" height="1"&gt;</content><author><name>Stuart Manning</name><uri>http://stuartmanning.com/members/Stuart-Manning.aspx</uri></author><category term="ASP.NET" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/ASP.NET/default.aspx" /><category term="ASP.NET AJAX" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/ASP.NET+AJAX/default.aspx" /><category term="VS 2005" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/VS+2005/default.aspx" /><category term="VS 2008" scheme="http://stuartmanning.com/blogs/aspnet/archive/tags/VS+2008/default.aspx" /></entry></feed>