AJAX benefits
I get a lot of feedback by email and comments on my blog. Sorry, if I cannot answer all that fast.
A lot of developers are asking me what are the benefits using the AJAX .NET Wrapper DLL or simply AJAX (XmlHttpRequest and Javascript). Long time ago I had to build an application (intranet) that was running in Internet Explorer, but no use of a web server. The data access has be done using COM/DCOM objects and XML to be transformed with XSL to HTML. The complete application was only using static HTML files but dynamic pages (like monitor machines running,...). Later we decided to migrate the application to ASP.NET web application. With C# and the Just-in-Time complier we thought it would be more faster. But this was wrong. Only with the right use of Javascript we could make the same speed as we had done with the old version.
What are the benefits of using AJAX?
There will be no postback to the server that will render the complete page. If you display a big table with a lot of data inside (CSS, HTML,...) the page may be about 80 kB. This big "string" must be created on the server and must be send to client also. With AJAX only the new data will be transmitted, you will save CPU usage on the web server, you will save network traffic (i.e. using slow modem connections or mobile phones/GPRS).
With the AJAX .NET Wrapper DLL you will save time develop such methods. You can simply add new methods to be exported (on thy fly).
See also: http://dotnet.org.za/armand/archive/2005/04/12/16934.aspx
4 Comments
Comments have been disabled for this content.
Martin said
Wow, this seems to work with "normal" html-files too!
I renamed the "default.aspx" file in your example code to "default.htm" and removed the first line of that file (<%@ Page language="c#" ...) and it still works!
How cool is that!?!
Mehran Nikoo said
It has been so much discussion around AJAX. It is not a new concept, it is the same idea as the smart clients. You go the web route if you are talking about the reach so that everyone can use your application, or go the smart route if you need more functionality.
I don't think that AJAX has got much benefit over web or smart client. In some senses it has got the worst of both words, it is not interoperable between the platforms as at least you are programming against an XML API. It is very hard to develop, test and debug as well. The only benefit over the smart clients is the issue of deployment over the same platform, which is not a huge factor.
Michael Schwarz said
@Mehran Nikoo: I disagree with the debug problem, I can fully debug my solution and all calls that are made!!! What do you mean with "no debug"???
@Martin: Yes, it is working with any file that is supporting Javascript. There is also a discussion to implement this feature in a Macromedia Flash object.
James Geurts said
I haven't looked at your callback implementation, but with a proper one, the entire page lifecycle will not be processed on callback. The method used to get callback data (RaiseCallBack or whatever) is usually called around the Load event. Thus PreRender, Render, and any other events afterwards wont fire. That should reduce the total time of the request, too...
Granted there is an overhead associated w/ the client having to process the returned xml. Overall, the callback web request should be quicker than doing a complete postback.