Does asp.net ajax needs XML http? - asp.net

Ajax needs xmlhttp. Does Asp.net ajax, ajaxcontrol toolkits also needs xmlhttp for their smooth running.

Depending on the browser it will use either the built-in XmlHttpRequest object or an ActiveX control.

Ajax is XMLHttpRequest, so in short, yes ASP.Net needs that (or ActiveX for IE).

Yes, this is the browser component that AJAX uses to makes requests to the server. The AJAX Toolkit, or more specifically any control that gets data from the server, would require it. However, the way the toolkit runs...I'm not sure if any controls will run with it disabled, as the base set of client scripts expects it to be enabled.
You can read more about how AJAX utilizes XMLHttpRequest object here.

Related

Alternative to Updatepanel in ASP.net

I want to know whether there is any better option to perform AJAX operations in my ASP.net webforms other than Updatepanel.
Because updatepanel sends lot of viewstate data in the request which in term affects the peroformace of the Application.
Thank You in Advance
You have a few options. You can disable ViewState, or you can use "plain AJAX".
If you choose to use "plain AJAX", you can write your low level JavaScript code or use libraries such as jQuery to make the AJAX calls easier.
On the server side, you'll need to expose some kind of endpoint for the AJAX calls to communicate to. Some people use WebMethod, but that has been deprecated and I would avoid this approach. You can use ASP.NET Web API in .NET 4.5, or in any version of .NET you can use handlers or generic handlers (.ashx) to expose endpoints.

XMLHTTPREQUEST or AJAX Update panel?

whenever I've used Ajax, I've used asp.net Ajax update panel and script manager provided in visual studio (and Ajax extensions if I needed them), but just recently I bought this (Pro Ajax and .Net 2.0 Platform and in this book the whole focus of Ajax has been XMLHTTPREQUEST, and there is no discussion of script manager, update panel or what so ever.
So, I wanted to know, is there any difference between these two or is this visual studio's update manager is just a wrapper around XMLHTTPREQUEST? Also, which one is better performance wise, or are they just the same? And finally, which one should I use?
Script Manager, Update Panel are Microsoft implementation of the AJAX framework. Internally it use XmlHttpRequest to make out-of-bound request.
Check out the below list of AJAX framework from wiki.
http://en.wikipedia.org/wiki/List_of_Ajax_frameworks
Microsoft AJAX implementation is type of full framework which provide rich programming model including server side controls, services and client side scripts. Eg. Update Panel server control lets you execute server-side code and return updated markup to the client browser with out-of-bound request.
But as for performance wise, it would be slower than service base/ajax because although out-of-bound request, UpdatePanel is really a post back to the server which will go through the full page life cycle.

Is the ASP.NET Ajax Library dead?

I've recently stumbled across a few blogs that say the ASP.NET Ajax Library is dead, in particular:
http://encosia.com/2010/10/04/understanding-jquerys-impact-on-microsoft-and-asp-net/
http://weblogs.asp.net/toddanglin/archive/2010/04/19/microsoft-ajax-client-library-is-dead-long-live-jquery.aspx
Is this generally true, technically and practically?
I've been to Microsoft talks on jQuery, and basically it sounded to me like they expected everyone to use jQuery for client-side-only DOM manipulation and ASP.NET Ajax was still used for it's Ajax components (like UpdatePanel) and as a basis for AJAX into .NET services made with WCF or just back to ASHX or other server code.
From being a component developer that targets ASP.NET, I can tell you that it's very much used by our customers, and we need to support it.
Yes, it is. Even for SharePoint developers (which uses ASP.net AJAX heavily) it's out of favor.
However, the SERVER SIDE ASP.net AJAX (UpdatePanel etc.) are alive and kicking. They have some shortcomings (UpdatePanel can send tons of viewstate back and forth).
But the Client Side Framework and ASP.net AJAX Library is dead.
Scalable comet ajax is more popular now. Try the samples of PokeIn library.
A technology can't die if it's customer base is so big!

Call a webservice in asp.net ajax

How can I calling a webservice not written by me from asp.net ajax. What's the latest and best way of doing it?
Call the Sys.Net.WebServiceProxy invoke Method
Details here
ASP.NET AJAX is not the preferred library any more. Use jQuery instead which also supports jsonp which is what you will need to call cross-domain web services from the client.

Using jQuery in ASP.NET

When using the AJAX functionality in jQuery, do I also have to have ASP.NET AJAX/.NET 3.5 installed also? or can I only use ASP.NET AJAX?
I'm unclear on whether or not I'm able to use AJAX in ASP.NET without ASP.NET AJAX or not.
No, you don't need ASP.NET AJAX installed to use the AJAX functionality of jQuery.
You can call PageMethods and Web Services without needing a ScriptManager control (which generates the JavaScript proxy objects that allow you to use familiar syntax to call web services and page methods).
Article on using jQuery to directly call ASP.NET AJAX page methods
Article on using jQuery to Consume ASP.NET JSON Web Services
Let me first clarify the use of jQuery. jQuery is simply a javascript library, and it has nothing to to with ASP.NET or any other server side platform such as PHP or JSP.
So you can simply use jQuery side by side with ASP.NET, or even combine jQuery with ASP.NET 3.5 that has AJAX built in.
You can also use jQuery's AJAX if you like, and it still can run in ASP.NET. If you want to combine both, please test your aspx page first if you also want to use ASP.NET's UpdatePanel with jQuery's AJAX, since it can bring incompatibilities between them.
No, if you're using jQuery you don't need ASP.NET AJAX installed.
ASP.NET Ajax is not needed in order to use jQuery, but the two work well together, hence the support from Microsoft.

Resources