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

<channel>
	<title>All Free Tech &#187; server</title>
	<atom:link href="http://www.allfreetech.com/tag/server/feed" rel="self" type="application/rss+xml" />
	<link>http://www.allfreetech.com</link>
	<description>For developers</description>
	<lastBuildDate>Tue, 01 Feb 2011 13:45:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>How To Assign A Strong Sa Password For Sql Server 2000?</title>
		<link>http://www.allfreetech.com/database/how-to-assign-a-strong-sa-password-for-sql-server-2000-487.html</link>
		<comments>http://www.allfreetech.com/database/how-to-assign-a-strong-sa-password-for-sql-server-2000-487.html#comments</comments>
		<pubDate>Sat, 19 Jun 2010 07:03:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[2000]]></category>
		<category><![CDATA[Assign]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Strong]]></category>

		<guid isPermaLink="false">http://www.allfreetech.com/?p=487</guid>
		<description><![CDATA[an administrator to install SQL Server Desktop Engine has a strong password to SQL Server to assign from a safety point of view. SQL databases are repositories of various critical data of a company. You can not do simply fall victim to any kind of illegal or illegitimate use, with weak or easily guessed passwords. [...]]]></description>
			<content:encoded><![CDATA[<p>an administrator to install SQL Server Desktop Engine has a strong password to SQL Server to assign from a safety point of view. SQL databases are repositories of various critical data of a company. You can not do simply fall victim to any kind of illegal or illegitimate use, with weak or easily guessed passwords. This article throws a light on how to specify a strong SA (system administrator) password when you install SQL Server Desktop Engine light. MSDE 2000 is the other name for SQL Server Desktop Engine.</p>
<p>. MDF files are also protected by passwords to prevent unauthorized use. Sometimes the complexity forgotten password in SQL results in an administrator or user, or lost it, that he just forgot. In such times, <strong> SQL Server Password Recovery software proves to be the elixir of life. </strong></p>
<p>Even if use of the SQL instance Windows Authentication, you need a strong password. We know that when using Windows Authentication, the SA account is not used by any user. But the current instance can later be switched to Mixed Mode, then the SA account is active log. Therefore, it is recommended that you should not assign the password blank or null. There should be a strong encryption.</p>
<p>If the SA (SQL Authentication login) account has a blank password, simple or known when an instance of MSDE 2000 to mixed mode, the MSDE instance is then easily switched by unauthorized users be accessed. The sa account can not be deleted, and it must always be protected with a secure password to restrict unauthorized access. Any user who has access to an instance of MSDE 2000 profits indirectly receive full control over the instance of MSDE, and have the option, all resources, the MSDE service account access.</p>
<p>To avoid such circumstances, you can use custom application code to install MSDE or SQL Server Desktop Engine. For that to observe the given points.</p>
<p>up if the user wanted to use MSDE in Mixed Mode, and will apply for the sa account a strong password for the sa account of the user. Use this new password in the MSDE setup. If the SA account is not used, generates a random string, and then pass that string as the SA password to the MSDE setup. If you somehow forget the password SQL Server database, or have lost the SQL Server database. MDF forget, you need to recover the SQL Server password immediately. What was your approach with such a delicate situation where you do not want the security of SQL database compromise? umzugehenMit SQL Server Password Recovery Software is available at recovering lost / forgotten passwords from master help file. MDF from SQL Server database. Even the multilingual passwords are recovered instantly using the software.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.allfreetech.com/database/how-to-assign-a-strong-sa-password-for-sql-server-2000-487.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Online Server Backup for SQL Databases</title>
		<link>http://www.allfreetech.com/database/sql-server/online-server-backup-for-sql-databases-264.html</link>
		<comments>http://www.allfreetech.com/database/sql-server/online-server-backup-for-sql-databases-264.html#comments</comments>
		<pubDate>Thu, 03 Jun 2010 05:59:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.allfreetech.com/?p=264</guid>
		<description><![CDATA[It is necessary to crash a backup of your computer files, as a safety measure in case of any computer. To avoid the loss of your files or databases. One excellent way to do this is to use SQL database backup. You can actually opt to backup your computer online. To select an Internet server, [...]]]></description>
			<content:encoded><![CDATA[<p>It is necessary to crash a backup of your computer files, as a safety measure in case of any computer. To avoid the loss of your files or databases. One excellent way to do this is to use SQL database backup. You can actually opt to backup your computer online. To select an Internet server, where you can put all your files or databases are stored, so that even if your computer is faulty or damaged you will still have your files are protected. The next time you need your files, all you have to do is to find any computer, log-in, and presto, you can still work with your files. </p>
<p>	Why use online SQL database backup? </p>
<p>	Today, the governments around the world recognized the need for data protection and now they are imposing regulations on businesses to safeguard their data. Governments have commissioned offsite measures for the protection of data or prevent data loss. </p>
<p>	Some of the rules and actions of governments for the protection of data collected </p>
<p>	In the U.S. &#8211; Health Insurance Portability and Accountability Act, Sarbanes- Oxley Act and Gramm-Leach-Bliley Act. </p>
<p>	In Europe &#8211; UK Data Protection Act, The Companies Act, EU Data Protection Directive, EC Directive on Privacy and Electronic Communications Regulations </p>
<p>	In Canada: Personal Information Protection and Electronic Document Act </p>
<p>
	In Japan: Personal Information Protection Act </p>
<p>
	Online or backup protection is encouraged for them to use more convenient. Online Backup also allows companies to fully utilize Internet bandwidth in call time and run the database restore function. Many online sites also use SQL database backup. Especially those who are using SQL Server. </p>
<p>	How to backup SQL database is a fairly lengthy process, so you can acquire an online account for storage services as your SQL database backup. You can also learn how to backup and restore script SQL database. </p>
<p>
	What you should find a SQL database backup </p>
<p>	The choice of your online SQL database backup might look to be easy if you know what to look for. Many companies offer SQL database backup. First assess what the provider in terms of safety, space and price, offer support, feature set and ease of use. SQL database backup is important, but it is also important that the backup provider is reliable. </p>
<p>	terms of security, your files should be protected with encrypted passwords. </p>
<p>	A good storage service offers plenty of storage space at very reasonable prices. It should free trials and free set ups and a SQL database backup, if you can get much space to upload your files. </p>
<p>	Help Support should be part of the online storage services. You should tutorials and self-help through FAQs, manuals and online support via e-mail, phone or chat. </p>
<p>	Ease and use &#8211; storage services should be instructions that are easy to understand and easy to be carried out. The service should use, and everyone should be in a few minutes to learn the basic functions. <br />
	features should be easy to update, store, access and share files. There should be a scheduled backup, drag and drop window, and a remote access. Private and public sharing of files also provide a good service. </p>
<p>	If you want to go online for your SQL database backup research, choose the storage service provider that offers all the above mentioned features.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.allfreetech.com/database/sql-server/online-server-backup-for-sql-databases-264.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asp.net Is The Latest Version Of Microsoft&#8217;s Active Server Pages Technology (Asp)</title>
		<link>http://www.allfreetech.com/microsoft-net/asp-net/asp-net-is-the-latest-version-of-microsofts-active-server-pages-technology-asp-226.html</link>
		<comments>http://www.allfreetech.com/microsoft-net/asp-net/asp-net-is-the-latest-version-of-microsofts-active-server-pages-technology-asp-226.html#comments</comments>
		<pubDate>Tue, 25 May 2010 21:36:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Microsoft's]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.allfreetech.com/?p=226</guid>
		<description><![CDATA[ASP.NET is the Latest Version of Microsoft&#39;s Active Server Pages Technology (ASP) ASP.NET is the next generation ASP, but it&#39;s not an upgraded version of ASP.Visit Here Now http://dotnet-asansol.blogspot.com &#160;ASP.NET is an entirely new technology for server-side scripting. It was written from the ground up and is not backward compatible with classic ASP. ASP.NET is [...]]]></description>
			<content:encoded><![CDATA[<p><strong>ASP.NET is the Latest Version of Microsoft&#39;s Active Server Pages Technology (ASP)</strong></p>
<p>ASP.NET is the next generation ASP, but it&#39;s not an upgraded version of ASP.<strong>Visit Here Now</strong> <a href="http://dotnet-asansol.blogspot.com" onclick="javascript:pageTracker._trackPageview('/outgoing/article_exit_link');" rel="nofollow">http://dotnet-asansol.blogspot.com</a></p>
<p>&nbsp;ASP.NET is an entirely new technology for server-side scripting. It was written from the ground up and is not backward compatible with classic ASP. ASP.NET is the major part of the Microsoft&#39;s .NET Framework.</p>
<p>ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.</p>
<p>&bull; ASP.NET is a Microsoft Technology<br />
	&bull; ASP stands for Active Server Pages<br />
	&bull; ASP.NET is a program that runs inside IIS<br />
	&bull; IIS (Internet Information Services) is Microsoft&#39;s Internet server<br />
	&bull; IIS comes as a free component with Windows servers<br />
	&bull; IIS is also a part of Windows 2000 and XP Professional</p>
<p>ASP.NET 2.0 improves upon Asp.Net by adding support for several new features and ASP.NET 3.0 is not a new version of ASP.NET. It&#39;s just the name for a new ASP.NET 2.0 framework library with support for Windows Presentation Foundation, Windows Communication Foundation, Windows Workflow Foundation; and Windows Card Space.<br />
	Benefits of ASP.Net</p>
<p>&bull; ASP.NET has better language support, a large set of new controls and XML based components.<br />
	&bull; ASP.NET provides increased performance by running compiled code.<br />
	&bull; ASP.NET code is not fully backward compatible with ASP.<br />
	&bull; Event-driven programming<br />
	&bull; User authentication, with accounts and roles<br />
	&bull; Higher scalability<br />
	&bull; Easier configuration and deployment</p>
<p>If one desires a website with e-commerce functionalities then it is suggested to go for shopping carts built on the ASP.Net platform as it can incorporate all functionalities which are easier for users to get their online shop up and running in a short span of time.</p>
<p>ASP.NET website development as a technology allows developers to create shopping carts that are flexible, search engine friendly and can be set up quite easily. The flexibility provided by ASP .NET framework adds more value to your online storefront. You can add unlimited products, categories and even customize the layout and design according to your convenience, many sub categories can be created within the existing categories and these applications are easy that user themselves can alter the applications according to their need. Shopping carts developed using the ASP.NET framework support database friendly languages like MS-ACCESS and MS-SQL.</p>
<p>Outsourcing Asp.Net Development India</p>
<p>Going for outsourcing of ASP.net development India one of the major advantages that a company gets is quality solutions because of skilled manpower who are perfectly capable of delivering solutions when it comes to a wide array of software services, apart from the major amount of money which is saved.</p>
<p>At IndiaNic, we have worked on many types of Internet business solutions. Some of the business domains that we work on are E-commerce solutions, Asp.Net Development; Web services based .Net Application Development and many more.<strong>Visit Here Now</strong> <a href="http://dotnet-asansol.blogspot.com" onclick="javascript:pageTracker._trackPageview('/outgoing/article_exit_link');" rel="nofollow">http://dotnet-asansol.blogspot.com</a></p>
<div style="margin:5px;padding:5px;border:1px solid #c1c1c1;font-size: 10px;">
<p>&nbsp;</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.allfreetech.com/microsoft-net/asp-net/asp-net-is-the-latest-version-of-microsofts-active-server-pages-technology-asp-226.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Canceling Server Tasks with ASP.NET AJAX</title>
		<link>http://www.allfreetech.com/microsoft-net/asp-net/canceling-server-tasks-with-asp-net-ajax-75.html</link>
		<comments>http://www.allfreetech.com/microsoft-net/asp-net/canceling-server-tasks-with-asp-net-ajax-75.html#comments</comments>
		<pubDate>Sat, 23 Jan 2010 04:04:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.allfreetech.com/microsoft-net/asp-net/canceling-server-tasks-with-asp-net-ajax-75.html</guid>
		<description><![CDATA[Last month I built a framework to monitor ongoing server-side tasks from the client. Using this framework, which I&#8217;ll call Progress Monitor Framework (or PMF), you can provide Web users with information about the progress of operations running on the server, something that typically requires a lot of custom code to do. With PMF, you [...]]]></description>
			<content:encoded><![CDATA[<div class="ArticleNormalPara">Last month I built a framework to monitor ongoing server-side tasks from the client. Using this framework, which I&rsquo;ll call Progress Monitor Framework (or PMF), you can provide Web users with information about the progress of operations running on the server, something that typically requires a lot of custom code to do. With PMF, you can have a server-side task register the current state of its operation (as a percentage or as an estimate of the time left) and a client service to ping the server to read that state information. Once the state information is downloaded to the client, which happens out-of-band, updating the UI is a breeze.</div>
<div class="ArticleNormalPara">Some early feedback about last month&rsquo;s column pointed out two potential enhancements. The first concerns whether PMF can be used to stop ongoing server tasks, and the second looks for a better way to generate the markup for the progress bar.<span id="more-75"></span></div>
<p>&nbsp;</p>
<div class="ArticleTypeTitle" id="S1"><strong>Formalizing Remote Tasks</strong></div>
<div class="ArticleNormalPara">A remote task is a piece of code that executes on the server in response to a client event. There are three possible ways for an ASP.NET AJAX client page to trigger a remote task: by causing a postback managed by an UpdatePanel control, by invoking a method directly on the application&rsquo;s back end exposed through a local Web service, and by using a page method. Soon there will be a fourth method: a Windows<span class="superscript">&reg;</span> Communication Foundation (WCF) service.</div>
<div class="ArticleNormalPara">Once the task on the server has been triggered, the client no longer has control over it. The client page regains control over the operation only after the response generated by the task has been downloaded to the client and parsed. With PMF you can read the status of the task on the fly, but there is no mechanism for passing data to the server task dynamically.</div>
<p>&nbsp;</p>
<div class="ArticleTypeTitle" id="S2"><strong>Canceling Tasks the Easy Way</strong></div>
<div class="ArticleNormalPara">ASP.NET AJAX can make canceling remote operations really easy, but there are two restrictions. First, the task must have been started using UpdatePanel. Second, no extra work should be required on the server to compensate for the abrupt interruption of the task. <strong>Figure 1</strong> shows the source code of a sample UpdatePanel-based page that pops up a progress template with a Cancel button, as shown in <strong>Figure 2</strong>. By clicking the button, you cancel the operation. Or do you?</div>
<div class="MTPS_CollapsibleRegion">
<div class="CollapseRegionLink"><!-- ApplyClick with current id --><span><img class="LibC_o" src="http://i.msdn.microsoft.com/Global/Images/clear.gif" style="border-width: 0px; vertical-align: middle;" /> &nbsp;Figure&nbsp;1&nbsp;Canceling a Task Started via an UpdatePanel Postback </span></div>
<div class="MTPS_CollapsibleSection" style="display: block;">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl27_ctl00_ctl00_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl27_ctl00_ctl00_code" space="preserve" style="white-space: pre-wrap;"><span><span id="ctl00_MTContentSelector1_mainContentContainer_ctl27_ctl00_ctl00" xmlns:msxsl="urn:schemas-microsoft-com:xslt">&lt;html xmlns=&rdquo;http://www.w3.org/1999/xhtml&rdquo; &gt;
&lt;head runat=&rdquo;server&rdquo;&gt;
    &lt;title&gt;Canceling tasks&lt;/title&gt;
    &lt;style type=&rdquo;text/css&rdquo;&gt;
        #UpdateProgress1  {
            width: 270px; background-color: #ffff99; height:120px;
            top: 40%; left: 35%; position: absolute;
            border: solid 1px black;
        }
        #ProgressTemplate1  {
            font-size: 9pt; color: navy; font-family: verdana;
        }
    &lt;/style&gt;
&lt;/head&gt;

&lt;script language=&rdquo;javascript&rdquo; type=&rdquo;text/javascript&rdquo;&gt;
function abortTask()  {
    var obj = Sys.WebForms.PageRequestManager.getInstance();
    if (obj.get_isInAsyncPostBack())
        obj.abortPostBack();
}
&lt;/script&gt;

&lt;body&gt;
&lt;form id=&rdquo;form1&rdquo; runat=&rdquo;server&rdquo;&gt;
    &lt;asp:ScriptManager ID=&rdquo;ScriptManager1&rdquo; runat=&rdquo;server&rdquo; /&gt;
    &lt;asp:UpdatePanel ID=&rdquo;UpdatePanel1&rdquo; runat=&rdquo;server&rdquo;
            UpdateMode=&rdquo;Conditional&rdquo;&gt;
        &lt;ContentTemplate&gt;
            &lt;asp:Button runat=&rdquo;server&rdquo; ID=&rdquo;Button1&rdquo; Text=&rdquo;Start Task ...&rdquo;
                onclick=&rdquo;Button1_Click&rdquo; /&gt;
            &lt;hr /&gt;
            &lt;asp:Label runat=&rdquo;server&rdquo; ID=&rdquo;Label1&rdquo; /&gt;&lt;br /&gt;
        &lt;/ContentTemplate&gt;
    &lt;/asp:UpdatePanel&gt;
    &lt;hr /&gt;

    &lt;asp:UpdateProgress runat=&rdquo;server&rdquo; ID=&rdquo;UpdateProgress1&rdquo;&gt;
        &lt;ProgressTemplate&gt;
            &lt;div ID=&rdquo;ProgressTemplate1&rdquo;&gt;&lt;p style=&rdquo;margin:5px;&rdquo;&gt;
                &lt;img alt=&rdquo;&rdquo; src=&rdquo;Images/indicator.gif&rdquo;
                    align=&rdquo;left&rdquo; /&gt;&amp;nbsp;&amp;nbsp;
                &lt;span id=&rdquo;Msg&rdquo;&gt;Your request has been submitted and
                    it may take a while to complete.
                &lt;br /&gt;&lt;br /&gt;Please, wait ... &lt;/span&gt;
                &lt;p align=&rdquo;center&rdquo;&gt;
                &lt;input type=&rdquo;button&rdquo; value=&rdquo;Cancel&rdquo;
                    onclick=&rdquo;abortTask()&rdquo; /&gt;&lt;/p&gt;
            &lt;/div&gt;&lt;/p&gt;
        &lt;/ProgressTemplate&gt;
    &lt;/asp:UpdateProgress&gt;
&lt;/form&gt;&lt;/body&gt;&lt;/html&gt;

</span></span></pre>
</div></div>
</p></div>
</div>
<div class="ArticleImageSpacer"><img alt="" onclick="var<br />
large='http://i.msdn.microsoft.com/cc163380.fig02_L(en-us).gif'; var<br />
small='http://i.msdn.microsoft.com/cc163380.fig02(en-us).gif'; var<br />
current= this.src; if (current == small) this.src = large; else this.src<br />
 = small;" onmouseover="this.style.cursor='pointer';" src="http://i.msdn.microsoft.com/cc163380.fig02%28en-us%29.gif" /></p>
<div class="ArticleImageCaptionText">Figure 2<strong>&nbsp;Progress Template with a Cancel Button&nbsp;</strong>(Click the image for a larger view)</div>
</div>
<div class="ArticleNormalPara">As you can see in the abortTask function in <strong>Figure 1</strong>, the progress template contains a client button bound to some JavaScript code. The first thing the function does is retrieve the page request manager. In the Microsoft<span class="superscript">&reg;</span> AJAX client library, the PageRequestManager object is the nerve center of partial rendering. Upon page initialization, the page request manager registers a handler for the form&rsquo;s submit event. In this way, the request manager is involved each time the page is going to post back. At this point, the request manager makes a copy of the request&rsquo;s body as prepared by the browser and runs it through the current HTTP executor&mdash;by default, the popular XMLHttpRequest object.</div>
<div class="ArticleNormalPara">The page request manager sets up the eventing model of partial rendering and tracks the ongoing operation. If there&rsquo;s any pending operation, then the Boolean property isInAsyncPostBack will return true.</div>
<div class="ArticleNormalPara">When the user clicks the Cancel button shown in <strong>Figure 1</strong>, the page request manager aborts the current request through its abortPostBack method. The page request manager is a singleton object, meaning that all calls are conveyed to just one instance. The reason this is so is tightly related to the mechanics of partial rendering. Partial rendering consists of sending a page request that goes through the usual processing on the server (except for the rendering stage). Among other things, this means that the viewstate is sent over and used to rebuild the last known good state of server controls. Postback and state-changed events are fired regularly, and the viewstate is updated based on these operations. The updated viewstate is then sent back along with the partially modified markup.</div>
<div class="ArticleNormalPara">Because of the viewstate, two asynchronous postback calls from the same page need to be serialized, and only one at a time is allowed to run. For this reason, the abortPostBack method on the page request manager has no need to figure out which request you want to stop&mdash;there&rsquo;s at most one pending request.</div>
<p>&nbsp;</p>
<div class="ArticleTypeTitle" id="S3"><strong>Inside the abortPostBack Method</strong></div>
<div class="ArticleNormalPara">Let&rsquo;s briefly take a look at the source code of the abortPostBack method on the PageRequestManager class:</div>
<div class="ArticleNormalPara">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl06_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl06_code" space="preserve" style="white-space: pre-wrap;"><span id="ctl00_MTContentSelector1_mainContentContainer_ctl06" xmlns:msxsl="urn:schemas-microsoft-com:xslt">function Sys$WebForms$PageRequestManager$abortPostBack()
{
    if (!this._processingRequest &amp;&amp; this._request)
    {
        this._request.get_executor().abort();
        this._request = null;
    }
}
</span></pre>
</div></div>
</div>
<div class="ArticleNormalPara">If there&rsquo;s a pending request, the manager instructs the executor of the request to abort. The executor is a JavaScript class that inherits from Sys.Net.WebRequestExecutor and takes care of sending the request and receiving the response.</div>
<div class="ArticleNormalPara">In the Microsoft AJAX client library, there&rsquo;s only one executor class&mdash;the Sys.Net.XMLHttpExecutor class&mdash;and it uses the XMLHttpRequest object to execute a request. In brief, when the preceding code calls the abort method, it basically tells the XMLHttpRequest object to abort. Put another way, it simply tells the socket through which the executor receives response data that it must close.</div>
<div class="ArticleNormalPara">Now, let&rsquo;s suppose that the remote task performs a disruptive action on the server. For example, let&rsquo;s say that the user is given a chance to delete a few records from a database table by clicking a button. Attempts to cancel the operation via the process described above doesn&rsquo;t actually stop the server operation. All it does is close the socket through which you would receive a confirmation message. The abortPostBack method on the PageRequestManager object is merely a client-side method that has no effect on what&rsquo;s going on in the server.</div>
<p>&nbsp;</p>
<div class="ArticleTypeTitle" id="S4"><strong>Designing an Interruptible Task</strong></div>
<div class="ArticleNormalPara">For the abort request to be effective on the server operation, the task must be interruptible. In other words, the task has to periodically check for instructions from the client that tell it to exit. A bidirectional version of PMF would help.</div>
<div class="ArticleNormalPara">When I first implemented PMF, the client and server elements of the framework shared a common data container that the server used to write data about its progress and the client used to read that data, in order to update the user interface. Some enhancements are required to make the server code receive and process dynamic client feedback such as a click on the Cancel button.</div>
<div class="ArticleNormalPara">The progress server API is now based on this contract:</div>
<div class="ArticleNormalPara">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl07_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl07_code" space="preserve" style="white-space: pre-wrap;"><span id="ctl00_MTContentSelector1_mainContentContainer_ctl07" xmlns:msxsl="urn:schemas-microsoft-com:xslt">public interface IProgressMonitor
{
    void SetStatus(int taskID, object message);
    string GetStatus(int taskID);

    bool ShouldTerminate(int taskID);
    void RequestTermination(int taskID);
}
</span></pre>
</div></div>
</div>
<div class="ArticleNormalPara">I&rsquo;ve added two new methods: ShouldTerminate and RequestTermination. The former returns a Boolean value indicating whether the ongoing task should be terminated. The RequestTermination method represents the entry point in the API for clients wanting to stop a task. When invoked, the method creates a task-related entry in the data container (the ASP.NET Cache) that ShouldTerminate checks to determine whether interruption was requested.</div>
<div class="ArticleNormalPara">The IProgressMonitor interface defined above dictates the expected behavior of an application on the server. You can implement it in a variety of classes that may use distinct data containers. I created a sample class using the ASP.NET cache named InMemoryProgressMonitor (see <strong>Figure 3</strong>). <strong>Figure 4</strong> provides a brief description of each method. As I discussed last month, the remote task calls SetStatus repeatedly to track its current execution status and mark its progress. To support dynamic interruption, the same task will periodically invoke ShouldTerminate to be informed of client requests to quit. <strong>Figure 5</strong> shows the typical structure of a monitorable and interruptible task.</div>
<div class="MTPS_CollapsibleRegion">
<div class="CollapseRegionLink"><!-- ApplyClick with current id --><span><img class="LibC_o" src="http://i.msdn.microsoft.com/Global/Images/clear.gif" style="border-width: 0px; vertical-align: middle;" /> &nbsp;Figure&nbsp;5&nbsp;Monitorable and Interruptible Remote Method </span></div>
<div class="MTPS_CollapsibleSection" style="display: block;">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl30_ctl00_ctl00_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl30_ctl00_ctl00_code" space="preserve" style="white-space: pre-wrap;"><span><span id="ctl00_MTContentSelector1_mainContentContainer_ctl30_ctl00_ctl00" xmlns:msxsl="urn:schemas-microsoft-com:xslt">[WebMethod]
public static string ExecuteTask(int taskID)
{
    InMemoryProgressMonitor progMonitor = new InMemoryProgressMonitor();

    // Preliminary check
    if (progMonitor.ShouldTerminate(taskID))
        return &ldquo;Task aborted--0% done&rdquo;;

    // First step
    progMonitor.SetStatus(taskID, &ldquo;0&rdquo;);
    DoStep(1);
    if (progMonitor.ShouldTerminate(taskID))
        return &ldquo;Task aborted--5% done&rdquo;;

    // Second step
    progMonitor.SetStatus(taskID, &ldquo;5&rdquo;);
    DoStep(2);
    if (progMonitor.ShouldTerminate(taskID))
        return &ldquo;Task aborted--45% done&rdquo;;

    // Third step
    progMonitor.SetStatus(taskID, &ldquo;45&rdquo;);
    DoStep(3);
    if (progMonitor.ShouldTerminate(taskID))
        return &ldquo;Task aborted--69% done&rdquo;;

    // Final step
    progMonitor.SetStatus(taskID, &ldquo;69&rdquo;);
    DoStep(4);

    if (progMonitor.ShouldTerminate(taskID))
        return &ldquo;Task aborted--100% done&rdquo;;

    return &ldquo;Task completed at: &ldquo; + DateTime.Now.ToString();
}

</span></span></pre>
</div></div>
</p></div>
</div>
<div class="MTPS_CollapsibleRegion">
<div class="CollapseRegionLink"><!-- ApplyClick with current id --><span><img class="LibC_o" src="http://i.msdn.microsoft.com/Global/Images/clear.gif" style="border-width: 0px; vertical-align: middle;" /> &nbsp;Figure&nbsp;4&nbsp;IProgressMonitor Interface </span></div>
<div class="MTPS_CollapsibleSection" style="display: block;"><span><br />
		</span></p>
<table class="charttable">
<tbody>
<tr>
<th><span>Method</span></th>
<th><span>Description</span></th>
</tr>
<tr>
<td valign="top"><span>GetStatus</span></td>
<td valign="top"><span>Reads the current status of the specified task from the internal data storage and returns it to the client as a string.</span></td>
</tr>
<tr>
<td valign="top"><span>SetStatus</span></td>
<td valign="top"><span>Invoked from the task, it writes the current status of the task to the internal data storage. The status is expressed as an object.</span></td>
</tr>
<tr>
<td valign="top"><span>RequestTermination</span></td>
<td valign="top"><span>Creates a task-related entry in the internal data storage to indicate that the client placed a request for termination.</span></td>
</tr>
<tr>
<td valign="top"><span>ShouldTerminate</span></td>
<td valign="top"><span>Returns true if the client placed a request to terminate the specified task.</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="MTPS_CollapsibleRegion">
<div class="CollapseRegionLink"><!-- ApplyClick with current id --><span><img class="LibC_o" src="http://i.msdn.microsoft.com/Global/Images/clear.gif" style="border-width: 0px; vertical-align: middle;" /> &nbsp;Figure&nbsp;3&nbsp;InMemoryProgressMonitor </span></div>
<div class="MTPS_CollapsibleSection" style="display: block;">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl32_ctl00_ctl00_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl32_ctl00_ctl00_code" space="preserve" style="white-space: pre-wrap;"><span><span id="ctl00_MTContentSelector1_mainContentContainer_ctl32_ctl00_ctl00" xmlns:msxsl="urn:schemas-microsoft-com:xslt">public class InMemoryProgressMonitor : IProgressMonitor
{
    public const int MAX_TIME_MINUTES = 5;

    // Sets the current status of the task
    public void SetStatus(int taskID, object message)
    {
        HttpContext.Current.Cache.Insert(
            taskID.ToString(), message, null,
            DateTime.Now.AddMinutes(MAX_TIME_MINUTES),
            Cache.NoSlidingExpiration);
    }

    // Reads the current status of the task
    public string GetStatus(int taskID)
    {
        object o = HttpContext.Current.Cache[taskID.ToString()];
        return o == null ? string.Empty : (string)o;
    }

    // Captures any user feedback (i.e., abort button clicked)
    public bool ShouldTerminate(int taskID)
    {
        string taskResponseID = GetSlotForResponse(taskID);
        return HttpContext.Current.Cache[taskResponseID] != null;
    }

    // Sets the task for termination
    public void RequestTermination(int taskID)
    {
        string taskResponseID = GetSlotForResponse(taskID);
        HttpContext.Current.Cache.Insert(
            taskResponseID, (object) false, null,
            DateTime.Now.AddMinutes(MAX_TIME_MINUTES),
            Cache.NoSlidingExpiration);
    }

    private string GetSlotForResponse(int taskID)
    {
        return String.Format(&ldquo;{0}-Response&rdquo;, taskID);
    }
}

</span></span></pre>
</div></div>
</p></div>
</div>
<div class="ArticleNormalPara">The method featured in <strong>Figure 5</strong> orchestrates the various steps that make up the remote task. The task can be part of the application&rsquo;s middle tier and can be implemented as a workflow. It must be articulated in individual steps so that the client can plug into it to read status and request termination.</div>
<p><strong><br />
	</strong></p>
<div class="ArticleTypeTitle" id="S5"><strong>The Client Code</strong></div>
<div class="ArticleNormalPara">The client JavaScript code that triggers the remote task remains mostly unchanged from last month&rsquo;s. You can use a page or a Web service method to start a task such as the ExecuteTask method in <strong>Figure 5</strong>, or run the server code through an UpdatePanel region:</div>
<div class="ArticleNormalPara">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl13_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl13_code" space="preserve" style="white-space: pre-wrap;"><span id="ctl00_MTContentSelector1_mainContentContainer_ctl13" xmlns:msxsl="urn:schemas-microsoft-com:xslt">&lt;asp:UpdatePanel runat=&rdquo;server&rdquo; ID=&rdquo;UpdatePanel1&rdquo;&gt;
    &lt;ContentTemplate&gt;
        &lt;asp:Button runat=&rdquo;server&rdquo; ID=&rdquo;Button1&rdquo; Text=&rdquo;Start Task ...&rdquo;
             OnClick=&rdquo;Button1_Click&rdquo; /&gt;
        &lt;hr /&gt;
        &lt;asp:Label runat=&rdquo;server&rdquo; ID=&rdquo;Label1&rdquo; /&gt;&lt;br /&gt;
    &lt;/ContentTemplate&gt;
&lt;/asp:UpdatePanel&gt;
</span></pre>
</div></div>
</div>
<div class="ArticleNormalPara">In the Button1_Click event handler, you define the remote task and make it call into a progress monitor object and the SetStatus and ShouldTerminate methods. To abruptly terminate a remote task, you add a Cancel button to the progress template&mdash;either an UpdateProgress control or a user-defined &lt;div&gt; block. This time, though, the click handler of the Cancel button doesn&rsquo;t point to the abortPostBack method on the page request manager. Instead it points to your own abort method in the client progress API:</div>
<div class="ArticleNormalPara">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl14_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl14_code" space="preserve" style="white-space: pre-wrap;"><span id="ctl00_MTContentSelector1_mainContentContainer_ctl14" xmlns:msxsl="urn:schemas-microsoft-com:xslt">&lt;script type=&rdquo;text/javascript&rdquo;&gt;
var progressManager = null;
var taskID = null;

function pageLoad() {
   progressManager = new Samples.PMF2.Progress();
}

function abortTask() {
    progressManager.abortTask(taskID);
}

...
&lt;/script&gt;
</span></pre>
</div></div>
</div>
<div class="ArticleNormalPara">Let&rsquo;s take a look at the modified client progress API. Coded in the progress.js file, this API must be linked to each ASP.NET AJAX page where you plan to use interruptible or monitorable tasks:</div>
<div class="ArticleNormalPara">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl15_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl15_code" space="preserve" style="white-space: pre-wrap;"><span id="ctl00_MTContentSelector1_mainContentContainer_ctl15" xmlns:msxsl="urn:schemas-microsoft-com:xslt">&lt;asp:ScriptManager ID=&rdquo;ScriptManager1&rdquo; runat=&rdquo;server&rdquo;
    EnablePageMethods=&rdquo;true&rdquo;&gt;
    &lt;Scripts&gt;
        &lt;asp:ScriptReference path=&rdquo;random.js&rdquo; /&gt;
        &lt;asp:ScriptReference path=&rdquo;progress.js&rdquo; /&gt;
    &lt;/Scripts&gt;
&lt;/asp:ScriptManager&gt;
</span></pre>
</div></div>
</div>
<div class="ArticleNormalPara">The random.js file is a dependency of progress.js and defines a method that generates random numbers for tasks. To track the status of a remote task from the client, you poll the server at regular intervals. To stop an ongoing task or, more precisely, to place a request to stop a task, you invoke a server method exposed by the progress monitor server API as part of the application&rsquo;s back end:</div>
<div class="ArticleNormalPara">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl16_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl16_code" space="preserve" style="white-space: pre-wrap;"><span id="ctl00_MTContentSelector1_mainContentContainer_ctl16" xmlns:msxsl="urn:schemas-microsoft-com:xslt">// Cancel the operation
function Samples$PMF2$Progress$abortTask() {
    PageMethods.TerminateTask(_taskID, null, null, null);
}
</span></pre>
</div></div>
</div>
<div class="ArticleNormalPara">I opted for page methods to expose this client-callable function. <strong>Figure 6</strong> provides an architectural view of the overall solution.</div>
<div class="ArticleImageSpacer"><img alt="" onclick="var<br />
large='http://i.msdn.microsoft.com/cc163380.fig06_L(en-us).gif'; var<br />
small='http://i.msdn.microsoft.com/cc163380.fig06(en-us).gif'; var<br />
current= this.src; if (current == small) this.src = large; else this.src<br />
 = small;" onmouseover="this.style.cursor='pointer';" src="http://i.msdn.microsoft.com/cc163380.fig06%28en-us%29.gif" /></p>
<div class="ArticleImageCaptionText">Figure 6<strong>&nbsp;Bidirectional Progress Monitor Framework&nbsp;</strong>(Click the image for a larger view)</div>
</div>
<div class="ArticleNormalPara">When the user clicks the Cancel button, an out-of-band call is triggered to execute the TerminateTask method defined as a page method on the codebehind class of the page. The TerminateTask method creates a task-related entry in the internal data storage (the ASP.NET cache). This entry is named after the task ID appended with a &quot;Quit&quot; suffix. A task designed to be interruptible checks this entry at various stages during its execution. If the entry is found, the server task aborts (see <strong>Figure 7</strong>).</div>
<div class="ArticleImageSpacer"><img alt="" onclick="var<br />
large='http://i.msdn.microsoft.com/cc163380.fig07_L(en-us).gif'; var<br />
small='http://i.msdn.microsoft.com/cc163380.fig07(en-us).gif'; var<br />
current= this.src; if (current == small) this.src = large; else this.src<br />
 = small;" onmouseover="this.style.cursor='pointer';" src="http://i.msdn.microsoft.com/cc163380.fig07%28en-us%29.gif" /></p>
<div class="ArticleImageCaptionText">Figure 7<strong>&nbsp;The User Clicked the Cancel Button, Ending the Server Task&nbsp;</strong>(Click the image for a larger view)</div>
</div>
<div class="ArticleNormalPara">Implemented in this way, task cancellation is more effective. If you simply abort the client postback during an UpdatePanel refresh, all that happens is that the client socket through which you receive responses is closed down. There is no impact on the code running on the server. There&rsquo;s also no built-in way to programmatically stop a remote call to a Web service or page method. In this case, the JavaScript proxy class completely hides the request object being used to push the call. Although the request object and its executor have an abort method, there&rsquo;s no way to find a reference to it in the context of service method call.</div>
<div class="ArticleNormalPara">In the end, if you need to allow for remote task control, the Progress Indicator pattern is the only way to go. You set up a parallel channel to monitor the status and to pass further information such as a quit command, to the running task. The same architecture allows the client to change parameters on the fly or to request additional operations. The bidirectional progress monitor framework is a duplex channel that a server task and its JavaScript client can use to exchange data in the form of messages.</div>
<p>&nbsp;</p>
<div class="ArticleTypeTitle" id="S6"><strong>Transactions</strong></div>
<div class="ArticleNormalPara">So far I created a framework to monitor and stop ASP.NET AJAX tasks. It is essential to note that the framework simply notifies the task that the user requested that it terminate. If properly designed, the task promptly stops and returns. But what happens to the work it has done already?</div>
<div class="ArticleNormalPara">In general, when a task is abruptly interrupted, it should undo any changes it has made and return. But the progress monitor framework can&rsquo;t make that happen. If you wrap the remote task in a transaction, however, you can roll it back once the task has been interrupted, assuming the work done only touches transactional resources, like a SQL Server&trade; database. Another option is to use a workflow. In that case, you&rsquo;d wrap the task in a TransactionScope activity and use a Code activity to set the current status and check for any termination request. If the task has to terminate, you throw an exception and automatically cause the transaction to roll back. (See the June 2007 Cutting Edge column for more information about transactional tasks in Windows Workflow Foundation.)</div>
<div class="ArticleNormalPara">Unfortunately, not all operations can easily be rolled back automatically. In general, you can implement the task within a TransactionScope block and safely and effectively use any objects that implement the ITransaction interface. If you do so, all of these objects will roll back or commit accordingly. And each of these objects will know how to undo its changes.</div>
<div class="ArticleNormalPara">The bottom line is that monitoring the progress of a remote task from the client is relatively easy and doesn&rsquo;t have significant side effects. The PMF adds some good abstraction on top of it and provides some readymade programming tools. Making a task interruptible poses additional issues especially when the task has an inherent transactional semantics. Writing the code that just notifies the task that the user requested it to terminate is the simplest part of the game. The real complexity lies in the task implementation and its compensation policy.</div>
<p><strong><br />
	</strong></p>
<div class="ArticleTypeTitle" id="S7"><strong>Generating the Bar</strong></div>
<div class="ArticleNormalPara">To top off the article, let&rsquo;s see how you can use JavaScript to easily generate progress bar markup and make it more maintainable. The progress bar you see in <strong>Figure 7</strong> is obtained by composing HTML tables, as shown here:</div>
<div class="ArticleNormalPara">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl19_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl19_code" space="preserve" style="white-space: pre-wrap;"><span id="ctl00_MTContentSelector1_mainContentContainer_ctl19" xmlns:msxsl="urn:schemas-microsoft-com:xslt">&lt;table width=&rdquo;100%&rdquo;&gt;
  &lt;tr&gt;
    &lt;td&gt;69% done&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td bgcolor=&rdquo;blue&rdquo; width=&rdquo;69%&rdquo;&gt;&amp;nbsp;&lt;/td&gt;
    &lt;td width=&rdquo;31%&rdquo;&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
</span></pre>
</div></div>
</div>
<div class="ArticleNormalPara">The table contains two rows&mdash;for the companion text and the gauge. The gauge is rendered using a two-cell row where cells are given background colors and proportional widths.</div>
<div class="ArticleNormalPara">If you take a close look at the preceding markup, you can identify at least three parameters&mdash;the message to the user, the value to represent, and the colors to use for the &quot;done&quot; and &quot;to-do&quot; regions. Instead of generating the markup as a string, wouldn&rsquo;t it be neater to create a JavaScript class? The code in <strong>Figure 8</strong> shows the primary method of the Samples.GaugeBar class.</div>
<div class="MTPS_CollapsibleRegion">
<div class="CollapseRegionLink"><!-- ApplyClick with current id --><span><img class="LibC_o" src="http://i.msdn.microsoft.com/Global/Images/clear.gif" style="border-width: 0px; vertical-align: middle;" /> &nbsp;Figure&nbsp;8&nbsp;Samples$GaugeBar$generateMarkup </span></div>
<div class="MTPS_CollapsibleSection" style="display: block;">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl38_ctl00_ctl00_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl38_ctl00_ctl00_code" space="preserve" style="white-space: pre-wrap;"><span><span id="ctl00_MTContentSelector1_mainContentContainer_ctl38_ctl00_ctl00" xmlns:msxsl="urn:schemas-microsoft-com:xslt">function Samples$GaugeBar$generateMarkup(text, perc) {
    var builder = new Sys.StringBuilder(&ldquo;&rdquo;);
    builder.append(&ldquo;&lt;table width=&rsquo;100%&rsquo;&gt;&lt;tr&gt;&lt;td colspan=&rsquo;2&rsquo;&gt;&amp;nbsp;&rdquo;);
    builder.append(text);
    builder.append(&ldquo;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td bgcolor=&rdquo;);
    builder.append(this._doneBackColor);
    builder.append(&ldquo; width=&rsquo;&rdquo;);
    builder.append(perc + &ldquo;%&rsquo;&gt;&rdquo;);
    builder.append(&ldquo;&amp;nbsp;&lt;/td&gt;&lt;td bgcolor=&rdquo;);
    builder.append(this._todoBackColor);
    builder.append(&ldquo; width=&rsquo;&rdquo;);
    builder.append(100-perc + &ldquo;%&rsquo;&gt;&rdquo;);
    builder.append(&ldquo;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&rdquo;);

    return builder.toString();
}

</span></span></pre>
</div></div>
</p></div>
</div>
<div class="ArticleNormalPara">The method takes text and a percentage and returns an HTML table with two rows. The top row just displays the text; the bottom row is articulated in two cells of different colors.</div>
<div class="ArticleNormalPara">The markup string is built using the JavaScript version of the Microsoft .NET Framework StringBuilder object. Defined in the Sys namespace, the JavaScript StringBuilder object has a programming interface similar to its .NET Framework counterpart. You send text to StringBuilder&rsquo;s internal buffer, and then output the text using the toString method.</div>
<div class="ArticleNormalPara">The Samples.GaugeBar class has one method, generateMarkup, and properties such as background color for the &quot;done&quot; and &quot;to-do&quot; areas and the foreground color for the companion text. For performance reasons, the class operates as a singleton. The class is not very big, but still there&rsquo;s no reason to create a new instance of it every time you need to update the bar. As a result, you define a static instance of the class and add a few static methods and properties:</div>
<div class="ArticleNormalPara">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl22_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl22_code" space="preserve" style="white-space: pre-wrap;"><span id="ctl00_MTContentSelector1_mainContentContainer_ctl22" xmlns:msxsl="urn:schemas-microsoft-com:xslt">Samples.GaugeBar.registerClass(&lsquo;Samples.GaugeBar&rsquo;);
Samples.GaugeBar._staticInstance = new Samples.GaugeBar();
Samples.GaugeBar.generateMarkup = function(text, perc) {
   return Samples.GaugeBar._staticInstance.generateMarkup(text, perc);
}
</span></pre>
</div></div>
</div>
<div class="ArticleNormalPara">You have a number of options for customizing the gauge bar. To change colors, do the following:</div>
<div class="ArticleNormalPara">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl23_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl23_code" space="preserve" style="white-space: pre-wrap;"><span id="ctl00_MTContentSelector1_mainContentContainer_ctl23" xmlns:msxsl="urn:schemas-microsoft-com:xslt">Samples.GaugeBar.set_DoneBackColor(&ldquo;#ff00ee&rdquo;);
Samples.GaugeBar.set_TodoBackColor(&ldquo;#ffccee&rdquo;);
</span></pre>
</div></div>
</div>
<div class="ArticleNormalPara">Likewise, you can add a nice 3D effect by defining an outset border style on the &quot;done&quot; cell of the table, like so:</div>
<div class="ArticleNormalPara">
<div class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl24_">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">&nbsp;</div>
</p></div>
<div dir="ltr" style="background-color: rgb(221, 221, 221);">
<pre class="libCScode" id="ctl00_MTContentSelector1_mainContentContainer_ctl24_code" space="preserve" style="white-space: pre-wrap;"><span id="ctl00_MTContentSelector1_mainContentContainer_ctl24" xmlns:msxsl="urn:schemas-microsoft-com:xslt">if (this._effect3D)
    builder.append(&ldquo; style=&rsquo;border:outset white 2px;&rsquo;&rdquo;);
</span></pre>
</div></div>
</div>
<div class="ArticleNormalPara">Creating a class to expose functionalities makes JavaScript programming significantly more manageable. If you ever had to deal with Dynamic HTML behaviors a few years ago, you know what I mean. The Microsoft client AJAX library is a big step forward as it enables you to write complex JavaScript code much more easily. Most AJAX professionals would probably agree that for powerful AJAX programming, richer JavaScript capabilities are a must.</div>
<div class="ArticleNormalPara">&nbsp;</div>
<div class="ArticleNormalPara"><span class="CodeDownloadText">Code download available at: </span> <a href="http://download.microsoft.com/download/f/2/7/f279e71e-efb0-4155-873d-5554a0608523/CuttingEdge2007_08.exe">CuttingEdge2007_08.exe</a> <span class="CodeDownloadText"> (167 KB) </span></div>
<div class="ArticleNormalPara">
<div class="ColumnByLine">&nbsp;</div>
<div class="ColumnByLine"><strong>Dino Esposito</strong></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.allfreetech.com/microsoft-net/asp-net/canceling-server-tasks-with-asp-net-ajax-75.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

