Tuesday, March 29, 2005

 

Get Ready for Script CallBacks in ASP.NET 2.0

How many times have you thought of communicating with your server without posting or refreshing your page.You might have accomplished the same using java applets, where you opened a separate communication channel to talk to your server.Lets take an example .Let's say you are developing a charting application that shows your stock holding in the form of a chart.You want your chart to be updated at regular intervals to reflect your latest status.You can easily achieve this by a writing a charting applet.Are there any other ways to achieve the same thing.Definitely!!!!

ASP.NEt 2.0 introduces the notion of Script Call Backs that perform the same purpose i.e talking to your server independently and asynchronously without refreshing the current page.Well how does this magic work.It's simple and Micrsoft had introduced the same concept earlier in the form of "Remote Scripting" ,but now the Script Call Back Mechanism is much tightly intergrated into the ASP.NET 2.0 framework.So here is whats happening under the hood. The Script Call Back is binded to a trigger .When the trigger is instantiated it uses a COM object to issue an HTTP POST or GET command to the specified target URL. The COM object used here is an old acquaintance of many developers:
var xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");

Once the request is made to the server,the server calls the appropriate method,sends the result and the browser can change the UI of the current page using DHTML to reflect the results/changes.
Check it out at
http://msdn.microsoft.com/msdnmag/issues/04/08/CuttingEdge/

Comments:
Can be done with ASP 1.x, see this:

http://codeproject.com/aspnet/ScriptCallbackFramework.asp

Cheers :)
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?