<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-5813054539441597990</id><updated>2009-10-28T12:24:35.069-07:00</updated><title type='text'>.Net Solutions</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://bugsolutions.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5813054539441597990/posts/default'/><link rel='alternate' type='text/html' href='http://bugsolutions.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Gs</name><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5813054539441597990.post-1587465723324615302</id><published>2008-07-14T23:49:00.000-07:00</published><updated>2008-07-14T23:53:12.630-07:00</updated><title type='text'>How To Make Application and Directory-Specific Configuration Settings in an ASP.NET Application</title><content type='html'>&lt;h3 style="font-family: arial;" id="tocHeadRef"&gt;&lt;span style="font-size:85%;"&gt;Use the Location Element in the Machine.config File &lt;/span&gt;&lt;/h3&gt;&lt;script type="text/javascript"&gt;loadTOCNode(2, 'summary');&lt;/script&gt;&lt;span style="font-family: arial;font-size:85%;" &gt;&lt;br /&gt;To specify settings that apply to a Web application or&lt;br /&gt;    directory, you can add the &amp;lt;&lt;b&gt;location&lt;/b&gt;&amp;gt; element to the &amp;lt;&lt;b&gt;configuration&lt;/b&gt;&amp;gt; element of a system Machine.config file. This is useful when&lt;br /&gt;    you centralize configuration settings in a single file. This is also useful in&lt;br /&gt;    Web-hosting environments to mandate specific configuration settings on&lt;br /&gt;    individual Web applications.&lt;br /&gt;&lt;br /&gt;The &lt;b&gt;&amp;lt;location&amp;gt;&lt;/b&gt; element contains two attributes, &lt;b&gt;path&lt;/b&gt; and &lt;b&gt;allowOverride&lt;/b&gt;. The &lt;b&gt;path&lt;/b&gt;&lt;br /&gt;    configuration settings cover. To specify that the settings in the &lt;b&gt;&amp;lt;location&amp;gt;&lt;/b&gt; element apply to the default Web site, set the &lt;b&gt;path&lt;/b&gt; attribute to &lt;strong class="uiterm"&gt;Default Web Site&lt;/strong&gt;. To specify that&lt;br /&gt;    the settings apply to the application that is named &lt;strong class="uiterm"&gt;MyApp&lt;/strong&gt; in&lt;br /&gt;    the default Web site, set the &lt;b&gt;path&lt;/b&gt; attribute to &lt;strong class="uiterm"&gt;"Default Web Site/MyApp"&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When the &lt;b&gt;allowOverride&lt;/b&gt; attribute is &lt;b&gt;false&lt;/b&gt;, the Web.config files in the Web application directories cannot&lt;br /&gt;    override the settings that you specified in the &lt;b&gt;&amp;lt;location&amp;gt;&lt;/b&gt; element. This is a useful setting in environments where you must&lt;br /&gt;    restrict application developers in how they configure a Web application. The&lt;br /&gt;    following example shows a part of a Machine.config file that requires&lt;br /&gt;    authentication to access the MyApp application on the default Web site and that&lt;br /&gt;    cannot be overridden by settings in a Web.config file:&lt;/span&gt; attribute defines the site or virtual directory that the   &lt;code&gt;&lt;/code&gt;&lt;pre class="code"&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;location path=”Default Web Site/MyApp” allowOverride=”false”&amp;gt;&lt;br /&gt;      &amp;lt;system.web&amp;gt;&lt;br /&gt;          &amp;lt;authorization&amp;gt;&lt;br /&gt;              &amp;lt;allow users=”?” /&amp;gt;&lt;br /&gt;          &amp;lt;/authorization&amp;gt;&lt;br /&gt;      &amp;lt;/system.web&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/location&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/pre&gt;&lt;h3 id="tocHeadRef"&gt; &lt;span style="font-family: arial;font-size:85%;" &gt;Use the Location Element in the Web.config File &lt;/span&gt;&lt;/h3&gt;&lt;script type="text/javascript"&gt;loadTOCNode(2, 'summary');&lt;/script&gt;&lt;span style="font-family: arial;font-size:85%;" &gt;&lt;br /&gt;To specify settings that apply to a specific application or&lt;br /&gt;    directory, add the &amp;lt;&lt;b&gt;location&lt;/b&gt;&amp;gt; element to the &amp;lt;&lt;b&gt;configuration&lt;/b&gt;&amp;gt; element of an application Web.config file. The &amp;lt;&lt;b&gt;location&lt;/b&gt;&amp;gt; element typically contains a &amp;lt;&lt;b&gt;system.web&lt;/b&gt;&amp;gt; element and other configuration elements exactly as you use&lt;br /&gt;    them in the Web.config file. The &lt;b&gt;path&lt;/b&gt; attribute of the &amp;lt;&lt;b&gt;location&lt;/b&gt;&amp;gt; element specifies the virtual directory or the file name&lt;br /&gt;    where the location configuration items apply. The following example shows part&lt;br /&gt;    of an application Web.config file that specifies custom error messages for the&lt;br /&gt;    forum virtual directory.&lt;/span&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="code"&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;location path=”forum” &amp;gt;&lt;br /&gt;      &amp;lt;system.web&amp;gt;&lt;br /&gt;          &amp;lt;customErrors mode="RemoteOnly” defaultRedirect="forum-error.aspx"&amp;gt;&lt;br /&gt;              &amp;lt;error statusCode="404" redirect="forum-file-not-found.aspx" /&amp;gt;&lt;br /&gt;          &amp;lt;/customErrors&amp;gt;&lt;br /&gt;      &amp;lt;/system.web&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/location&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5813054539441597990-1587465723324615302?l=bugsolutions.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bugsolutions.blogspot.com/feeds/1587465723324615302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=5813054539441597990&amp;postID=1587465723324615302' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5813054539441597990/posts/default/1587465723324615302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5813054539441597990/posts/default/1587465723324615302'/><link rel='alternate' type='text/html' href='http://bugsolutions.blogspot.com/2008/07/how-to-make-application-and-directory.html' title='How To Make Application and Directory-Specific Configuration Settings in an ASP.NET Application'/><author><name>Gs</name><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08752845824720803706'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5813054539441597990.post-2604827516955049377</id><published>2008-07-06T21:01:00.000-07:00</published><updated>2008-07-06T21:06:02.671-07:00</updated><title type='text'>Changing parent window's URL from IFRAME content</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;If you want to control parent window's URL from a child iframe, you can't use variable destination how you would use that for frames because tag &lt;&gt; doesn't have this property.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Also you can't change parent.document.location variable because this variable is read-only for child iframes.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;To solve this problem, you need to define a javascript function at parent window and call it from iframe window. Here's an example how to change parent window's URL:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Parent window's content:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    &lt;&gt;iframe starts here&lt; /b &gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    &lt; src="'iframe1.html'"&gt;&lt; / iframe&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="font-family: arial;"&gt;iframe ends here&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    &lt; type="text/javascript"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        function change_parent_url(url)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        document.location=url;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        }       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    &lt; /script &gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Iframe's content:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    IFRAME content&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt; style="font-family: arial;" href="javascript:parent.change_parent_url('http://yahoo.com');"&gt;&lt;br /&gt;  Click here to change parent URL &lt; /a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5813054539441597990-2604827516955049377?l=bugsolutions.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bugsolutions.blogspot.com/feeds/2604827516955049377/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=5813054539441597990&amp;postID=2604827516955049377' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5813054539441597990/posts/default/2604827516955049377'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5813054539441597990/posts/default/2604827516955049377'/><link rel='alternate' type='text/html' href='http://bugsolutions.blogspot.com/2008/07/changing-parent-windows-url-from-iframe.html' title='Changing parent window&apos;s URL from IFRAME content'/><author><name>Gs</name><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08752845824720803706'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5813054539441597990.post-5973608250256664903</id><published>2008-07-06T20:46:00.000-07:00</published><updated>2008-07-06T20:52:00.902-07:00</updated><title type='text'></title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;If you’ve done much ASP.NET AJAX development, you’re no doubt familiar with JavaScript alert errors similar to the one pictured above. This particular one occurs on the official ASP.NET forums in FireFox, if you try to navigate away from viewing a user profile before the Recommended Reading panels asynchronously load.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Not only is the error message of “…” completely meaningless, but it blocks your intended navigation away from the page until you’ve dismissed the alert window. Hopefully, someone at Telligent will read this, because the ASP.NET AJAX framework gives us an easy way to replace the annoying JavaScript alerts and vastly improve the usability of our applications.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Some “exceptional” code &lt;/span&gt;&lt;/span&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;First, we’ll need some code to throw exceptions to test with:&lt;/span&gt;&lt;/p&gt;  &lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;protected void Button1_OnClick(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;throw new Exception("AJAX Error!");&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;This throws a server side error when Button1 makes an asynchronous callback. If Button1 is clicked, we’ll get a JavaScript alert:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_BKgX4KcXKlA/SHGSD9Hn6nI/AAAAAAAAAJA/imuaUt_KAdY/s1600-h/error.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://bp1.blogger.com/_BKgX4KcXKlA/SHGSD9Hn6nI/AAAAAAAAAJA/imuaUt_KAdY/s320/error.png" alt="" id="BLOGGER_PHOTO_ID_5220114039742917234" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;Handling the exception&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The key to custom error handling in ASP.NET AJAX is the EndRequestEventArgs class, available when handling the endRequest event. It provides information on any error conditions that have resulted and exposes a method to let the framework know that we’ve handled the errors on our own.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;I’m going to add a div, to serve as our replacement error message:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;div id="Error" style="visibility: hidden;"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  &lt;img src="http://www.blogger.com/close.png" onclick="CloseError()" id="CloseButton" alt="Close Button" /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  An error has occured while trying to process your request.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Next, some CSS to style the div and close button:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;#Error {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  top: 0px;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  right: 0px;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  width: 125px;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  background-color: yellow;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  border: solid 1px Black;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  padding: 10px;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  font-family: Sans-Serif;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  font-size: 10pt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  position: absolute;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  margin: 5px;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;#CloseButton {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  float: right;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  cursor: pointer;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Finally, we need to add some JavaScript to tie it all together:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Sys.Application.add_load(AppLoad);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;function AppLoad()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequest);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;function BeginRequest(sender, args) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  // Clear the error if it's visible from a previous request.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  if ($get('Error').style.visibility == "visible")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    CloseError();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;function EndRequest(sender, args) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  // Check to see if there's an error on this request.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  if (args.get_error() != undefined)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    // If there is, show the custom error.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    $get('Error').style.visibility = "visible";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    // Let the framework know that the error is handled,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    //  so it doesn't throw the JavaScript alert.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    args.set_errorHandled(true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;function CloseError() {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  // Hide the error div.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  $get('Error').style.visibility = "hidden";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The crux of this method is EndRequestEventArgs.set_errorHandled(). This tells the AJAX framework to call off the dogs and prevents the JavaScript alert from being displayed. Now, clicking Button1 results in this:&lt;/span&gt;&lt;br /&gt;&lt;a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_BKgX4KcXKlA/SHGSESEGnkI/AAAAAAAAAJI/RUFdOY6uBZs/s1600-h/error3.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://bp2.blogger.com/_BKgX4KcXKlA/SHGSESEGnkI/AAAAAAAAAJI/RUFdOY6uBZs/s320/error3.png" alt="" id="BLOGGER_PHOTO_ID_5220114045365296706" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;We have complete control over the error display. No JavaScript alert!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;source: &lt;/span&gt;&lt;a style="font-family: arial;" href="http://www.encosia.com/"&gt;encosia&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5813054539441597990-5973608250256664903?l=bugsolutions.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bugsolutions.blogspot.com/feeds/5973608250256664903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=5813054539441597990&amp;postID=5973608250256664903' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5813054539441597990/posts/default/5973608250256664903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5813054539441597990/posts/default/5973608250256664903'/><link rel='alternate' type='text/html' href='http://bugsolutions.blogspot.com/2008/07/if-youve-done-much-asp.html' title=''/><author><name>Gs</name><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08752845824720803706'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_BKgX4KcXKlA/SHGSD9Hn6nI/AAAAAAAAAJA/imuaUt_KAdY/s72-c/error.png' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5813054539441597990.post-1802264630352151583</id><published>2008-06-12T23:09:00.000-07:00</published><updated>2008-07-06T20:41:15.457-07:00</updated><title type='text'>Explicit Support for Service-Oriented Development</title><content type='html'>&lt;span style="font-family: arial;font-size:85%;" &gt;Creating applications in a service-oriented style is becoming the norm. For this to happen, the platforms on which those applications are built must provide the right support for creating service-oriented software. Achieving this is one of WCF’s most important goals.&lt;/span&gt;  &lt;p style="font-family: arial;font-family:arial;" class="MsoBodyText" &gt;&lt;span style="font-size:85%;"&gt;Thinking of an application as providing and consuming services is hardly a new idea. What is new is a clear focus on services as distinct from objects. Toward this end, WCF’s creators kept four tenets in mind during the design of this technology:&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: arial;font-family:arial;" class="BulletItem" &gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;n&lt;span style=""&gt;        &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;Share schema, not class&lt;/i&gt;. Unlike older distributed object technologies, services interact with their clients only through a well-defined XML interface. Behaviors such as passing complete classes, methods and all, across service boundaries aren’t allowed.&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: arial;font-family:arial;" class="BulletItem" &gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;n&lt;span style=""&gt;        &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;Services are autonomous&lt;/i&gt;. A service and its clients agree on the interface between them, but are otherwise independent. They may be written in different languages, use different runtime environments, such as the CLR and the Java Virtual Machine, execute on different operating systems, and differ in other ways.&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: arial;font-family:arial;" class="BulletItem" &gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;n&lt;span style=""&gt;        &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;Boundaries are explicit&lt;/i&gt;. A goal of distributed object technologies such as Distributed COM (DCOM) was to make remote objects look as much as possible like local objects. While this approach simplified development in some ways by providing a common programming model, it also hid the inescapable differences between local objects and remote objects. Services avoid this problem by making interactions between services and their clients more explicit. Hiding distribution is not a goal.&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: arial;font-family:arial;" class="BulletItem" &gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;n&lt;span style=""&gt;        &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;Use policy-based compatibility&lt;/i&gt;. When possible, determining which options to use between systems should rely on mechanisms defined in languages such as WSDL and WS-Policy. The ability for a client to consume a service is based on the intersection of what the client supports and what the service supports. &lt;/span&gt;&lt;/p&gt;  &lt;span style="font-family: arial;font-family:arial;font-size:85%;"  &gt;Service-oriented applications are the successor to the multi-tier applications of the last decade. As the architectural style continues to spread, this approach is becoming the default for a large share of new software. WCF is the foundation for service-oriented applications built on the .NET Framework, which makes it a mainstream technology for Windows-based software.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5813054539441597990-1802264630352151583?l=bugsolutions.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bugsolutions.blogspot.com/feeds/1802264630352151583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=5813054539441597990&amp;postID=1802264630352151583' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5813054539441597990/posts/default/1802264630352151583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5813054539441597990/posts/default/1802264630352151583'/><link rel='alternate' type='text/html' href='http://bugsolutions.blogspot.com/2008/06/explicit-support-for-service-oriented.html' title='Explicit Support for Service-Oriented Development'/><author><name>Gs</name><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08752845824720803706'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5813054539441597990.post-7605218961371568900</id><published>2008-05-21T22:18:00.000-07:00</published><updated>2008-05-21T22:31:40.765-07:00</updated><title type='text'>Building AJAX Enabled File Uploading System with Progress Bar Using ASP.NET 2.0</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;" id="intellitTxt"&gt;&lt;/span&gt;&lt;/span&gt; 	&lt;span style="font-size:85%;"&gt;Uploading files using ASP.NET Framework 1.0 / 2.0 / 3.0  	is pretty easy. Without much error handling, all we need is a couple of  	lines of code to upload a file to the web server. AJAX is playing a greater role these days in every  	webpage that pops up. Uploading files using ASP.NET AJAX is not a straight  	forward one. Those who do know about AJAX, it is used to update some  	portions/sections of a web page without affecting other sections. In other  	words, if you do want to refresh your web page on a button click but you  	still want to update the content of your web page, then you should use AJAX.&lt;/span&gt;&lt;div style="font-family: arial;" class="KonaBody"&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;In this article we will see how to upload files using  	ASP.NET and AJAX. We will also see how we can display a message, "Please  	wait … Upload in progress," during an upload is taking place. Displaying a  	"Wait message" always helps the user to know what is really going on;  	otherwise, users will have to wait and will not be sure what is going on  	until the upload is done.  &lt;/span&gt;&lt;/p&gt; &lt;/div&gt; &lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;" id="intellitTxt0"&gt;&lt;a class="pageTitle" id="#Page2"&gt;Common Aspects&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: arial;" class="KonaBody"&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;In order to use AJAX in ASP.NET we need to have a  	minimum of ASP.NET 2.0 Framework and 	&lt;a target="_blank" href="http://asp.net/ajax/downloads/"&gt;AJAX Extensions 1.0  	for ASP.NET&lt;/a&gt;. &lt;/span&gt;&lt;/p&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;In order to upload a file using AJAX, we are in need of  	the following main Web Server controls:&lt;/span&gt;&lt;/p&gt; 	&lt;p class="MsoListNumber"&gt;&lt;span style="font-size:85%;"&gt;1.&lt;span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;    	&lt;/span&gt;FileUpload Server Control&lt;/span&gt;&lt;/p&gt; 	&lt;p class="MsoListNumber"&gt;&lt;span style="font-size:85%;"&gt;2.&lt;span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;    	&lt;/span&gt;Button Server Control&lt;/span&gt;&lt;/p&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;Apart from the above, we need to specify the usual AJAX  	tags ScriptManager, UpdatePanel and ContentTemplate so that during run time  	the ASP.NET AJAX will know which section of the web page needs to be  	updated.  Let us take a look at the code which uses the above:&lt;/span&gt;&lt;/p&gt; 	&lt;p class="CodeListingHeading"&gt;&lt;span style="font-size:85%;"&gt;Listing 1&lt;/span&gt;&lt;/p&gt; 	&lt;div class="MsoNormal"&gt; 		&lt;pre&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: Black; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;1 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;html&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;2 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;head&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;3    &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;title&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;File Upload&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;title&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;4 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;head&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;5 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;body&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;6 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;form&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;id&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="form1"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&gt;&lt;/span&gt;&lt;br /&gt;7    &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:ScriptManager&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="ScriptManager1"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"/&gt;&lt;/span&gt;&lt;br /&gt;8    &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:UpdatePanel&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="UpdatePanel1"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&gt;&lt;/span&gt;&lt;br /&gt;9        &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ContentTemplate&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;10           &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:FileUpload&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="myFile"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;/&gt;&lt;/span&gt;&lt;br /&gt;11           &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Label&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="lblMsg"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Label&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;           &lt;br /&gt;12           &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Button&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="btnUpload"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;Text&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="Upload"&gt;&lt;/span&gt;&lt;br /&gt;13        &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ContentTemplate&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;14   &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:UpdatePanel&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;15 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;form&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;16 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;body&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;17 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;html&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt; 	&lt;/div&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;In the above code Line 7, 8 and 9 are the ones which  	specify which part of this web page needs to be updated. The FileUpload  	control and the Button control are within the AJAX UpdatePanel control. &lt;/span&gt;&lt;/p&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;You might think that when the user clicks the submit  	button, the page will be submitted to the server. Well, this is not true.  	The above code will not work. The reason is that FileUpload control does not  	work with asynchronous post backs, and therefore does not work from within  	an AJAX UpdatePanel. In simple words, the FileUpload control is not posted  	back to the server. &lt;/span&gt;&lt;/p&gt; &lt;/div&gt; &lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;" id="intellitTxt1"&gt;&lt;a class="pageTitle" id="#Page3"&gt;Triggers&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: arial;" class="KonaBody"&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;To resolve the above issue, we need to use the Trigger  	code block. Triggers allow us to force a post back. For an upload to happen,  	we need to access the FileUpload control in the server. In the following  	code snippet you can see how to include the Triggers block. We are invoking  	a PostBackTrigger. The control that will be forced to post back is  	“btnUpload.” Triggers block can be found in Lines 9, 10 and 11.&lt;/span&gt;&lt;/p&gt; 	&lt;p class="CodeListingHeading"&gt;&lt;span style="font-size:85%;"&gt;Listing 2&lt;/span&gt;&lt;/p&gt; 	&lt;div class="MsoNormal"&gt; 		&lt;pre&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: Black; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;1 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;html&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;2 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;head&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;3    &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;title&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;File Upload&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;title&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;4 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;head&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;5 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;body&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;6 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;form&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;id&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="form1"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&gt;&lt;/span&gt;&lt;br /&gt;7    &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:ScriptManager&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="ScriptManager1"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"/&gt;&lt;/span&gt;&lt;br /&gt;8    &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:UpdatePanel&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="UpdatePanel1"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&gt;&lt;/span&gt;&lt;br /&gt;9       &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;Triggers&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;10           &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:PostBackTrigger&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ControlID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="btnUpload"&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;/&gt;&lt;/span&gt;&lt;br /&gt;11       &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;Triggers&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;12       &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ContentTemplate&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;13           &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:FileUpload&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="myFile"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;/&gt;&lt;/span&gt;&lt;br /&gt;14           &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Label&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="lblMsg"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Label&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;           &lt;br /&gt;15           &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Button&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="btnUpload"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;Text&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="Upload"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;OnClick&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="UploadFile"&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;/&gt;&lt;/span&gt;&lt;br /&gt;16        &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ContentTemplate&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;17   &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:UpdatePanel&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;18 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;form&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;19 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;body&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;20 &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;html&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt; 	&lt;/div&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;The above code is now capable of doing a postback to  	the server. All we need is to write the usual code that we write for file  	upload inside the server side method UploadFile. This is the method which is  	invoked when the submit button “Upload” is clicked. The code will look like  	the following (written in C#).&lt;/span&gt;&lt;/p&gt; 	&lt;p class="CodeListingHeading"&gt;&lt;span style="font-size:85%;"&gt;Listing 3&lt;/span&gt;&lt;/p&gt; 	&lt;div class="MsoNormal"&gt; 		&lt;pre&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: Black; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;script runat="&lt;span" style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-size: 11px; font-weight: normal;"&gt;"server"&lt;/span&gt;&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;protected&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;void&lt;/span&gt; UploadFile(&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;object&lt;/span&gt; src, EventArgs e)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;if&lt;/span&gt; (myFile.HasFile)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;string&lt;/span&gt; strFileName;&lt;br /&gt;        strFileName &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; myFile.FileName;&lt;br /&gt;        myFile.PostedFile.SaveAs(Server.MapPath(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-size: 11px; font-weight: normal;"&gt;"."&lt;/span&gt;) &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-size: 11px; font-weight: normal;"&gt;"//"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;+&lt;/span&gt; strFileName);&lt;br /&gt;        lblMsg.Text &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; strFileName &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-size: 11px; font-weight: normal;"&gt;" Uploaded successfully!"&lt;/span&gt;;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/script&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt; 	&lt;/div&gt; &lt;/div&gt; &lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;" id="intellitTxt2"&gt;&lt;a class="pageTitle" id="#Page4"&gt;Displaying a "Please  Wait …" Message during an Upload &lt;/a&gt;&lt;/span&gt;&lt;/span&gt; &lt;div style="font-family: arial;" class="KonaBody"&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;To display the "Please Wait … Message" we need to use  	the UpdateProgress control. The UpdateProgress control that we will be using  	for our upload will be as follows:&lt;/span&gt;&lt;/p&gt; 	&lt;p class="CodeListingHeading"&gt;&lt;span style="font-size:85%;"&gt;Listing 4&lt;/span&gt;&lt;/p&gt; 	&lt;div class="MsoNormal"&gt; 		&lt;pre&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: Black; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:UpdateProgress&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="UP"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;AssociatedUpdatePanelID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="UpdatePanel1"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ProgressTemplate&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Label&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="lblWait"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;Text&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="Please wait.."&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Label&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ProgressTemplate&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;                         &lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:UpdateProgress&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt; 	&lt;/div&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;Each time the submit button is clicked the web page  	will be posted back to the server. You would think that you will see the  	message, “Please wait.” Well again, we need to look at one more aspect  	before we can see the “Please wait” message during a file upload. &lt;/span&gt;&lt;/p&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;We need to write a client side JavaScript function that  	will change the visibility of the UpdateProgress during the post back. The  	JavaScript will look like:&lt;/span&gt;&lt;/p&gt; 	&lt;p class="CodeListingHeading"&gt;&lt;span style="font-size:85%;"&gt;Listing 5&lt;/span&gt;&lt;/p&gt; 	&lt;div class="MsoNormal"&gt; 		&lt;pre&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: Black; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;script&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;language&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="javascript"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;type&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="text/javascript"&gt;&lt;/span&gt;&lt;br /&gt;function showWait()&lt;br /&gt;{&lt;br /&gt;    if ($get('myFile').value.length &gt; 0)&lt;br /&gt;    {&lt;br /&gt;        $get('UpdateProgress1').style.display = 'block';&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;script&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt; 	&lt;/div&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;The function showWait will have to be invoked during  	the form submission. In our scenario that would be the OnClientClick event  	for the button control.&lt;/span&gt;&lt;/p&gt; 	&lt;p class="CodeListingHeading"&gt;&lt;span style="font-size:85%;"&gt;Listing 6&lt;/span&gt;&lt;/p&gt; 	&lt;div class="MsoNormal"&gt; 		&lt;pre&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: Black; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Button&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="btnUpload"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;Text&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="Upload"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;OnClick&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="UploadFile"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;OnClientClick&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="javascript:showWait();"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt; 	&lt;/div&gt; 	&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;The complete code listing for both AJAX File Upload and  	Please Wait message is as follows:&lt;/span&gt;&lt;/p&gt; 	&lt;div class="MsoNormal"&gt; 		&lt;pre&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: Black; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;%@ Page Language="C#" AutoEventWireup="true"%&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;html&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;head&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;script&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&gt;&lt;/span&gt;&lt;br /&gt;protected void UploadFile(object src, EventArgs e)&lt;br /&gt;{&lt;br /&gt;    if (myFile.HasFile)&lt;br /&gt;    {&lt;br /&gt;        string strFileName;&lt;br /&gt;        strFileName = myFile.FileName;&lt;br /&gt;       myFile.PostedFile.SaveAs(Server.MapPath(".") + "//" + strFileName);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;script&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;script&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;language&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="javascript"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;type&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="text/javascript"&gt;&lt;/span&gt;&lt;br /&gt;function showWait()&lt;br /&gt;{&lt;br /&gt;    if ($get('myFile').value.length &gt; 0)&lt;br /&gt;    {&lt;br /&gt;        $get('UpdateProgress1').style.display = 'block';&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;script&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;title&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;File Upload&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;title&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;head&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;body&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;form&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;id&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="form1"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:ScriptManager&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="ScriptManager1"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"/&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:UpdatePanel&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="UpdatePanel1"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;Triggers&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:PostBackTrigger&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ControlID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="btnUpload"&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;/&gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;Triggers&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ContentTemplate&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:FileUpload&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="myFile"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;/&gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Label&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="lblMsg"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Label&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;           &lt;br /&gt;            &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;br&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;/&gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Button&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="btnUpload"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;Text&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="Upload"&lt;/span&gt;&lt;br /&gt;                &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;OnClick&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="UploadFile"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;OnClientClick&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="javascript:showWait();"/&gt;&lt;/span&gt;          &lt;br /&gt;            &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:UpdateProgress&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="UpdateProgress1"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&lt;/span&gt;&lt;br /&gt;                &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;AssociatedUpdatePanelID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="UpdatePanel1"&gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ProgressTemplate&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Label&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ID&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="lblWait"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;runat&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="server"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;BackColor&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="#507CD1"&lt;/span&gt;&lt;br /&gt;                        &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;Font-Bold&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="True"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ForeColor&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="White"&lt;/span&gt;&lt;br /&gt;                        &lt;span style="color: Red; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;Text&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;="Please wait ... Uploading file"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:Label&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ProgressTemplate&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:UpdateProgress&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;ContentTemplate&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;asp:UpdatePanel&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;form&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;body&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: Maroon; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;html&lt;/span&gt;&lt;span style="color: Blue; background-color: transparent; font-size: 11px; font-weight: normal;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt; 	&lt;/div&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5813054539441597990-7605218961371568900?l=bugsolutions.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bugsolutions.blogspot.com/feeds/7605218961371568900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=5813054539441597990&amp;postID=7605218961371568900' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5813054539441597990/posts/default/7605218961371568900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5813054539441597990/posts/default/7605218961371568900'/><link rel='alternate' type='text/html' href='http://bugsolutions.blogspot.com/2008/05/building-ajax-enabled-file-uploading.html' title='Building AJAX Enabled File Uploading System with Progress Bar Using ASP.NET 2.0'/><author><name>Gs</name><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08752845824720803706'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry></feed>