Wednesday, March 21, 2012

use httpHandler of AJAX in web application

Hey all,

I want to implement AJAX in my current running web application.

I am going to use .

<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>

in my web application.

I want to know ...

(1). will there be any side effect of the above code,

(2) will my current functionality got affected.

(3)what this code is all about and what it does.

1. No your should not see any side effects

2. The functionality should remain intact.

3. All this does is tell the webserver that when it gets a request for an .asmx page, to use the System.Web.Script.Services.ScriptHandlerFactory, and System.Web.Extensions classes to handle the request. for all verbs. So you .aspx, .ascx, etc will go unchanged and will continue to use the default HttpHandler. It then tells the web server to that when you recieve a GET or HEAD request for the ScriptResource.axd to use the System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions classes to handle te request. But since these classes extend the default classes that would normally handle the .asmx requests, then all your existing .asmx requests will work as originally intended. The above classes add the ability to JSON serialize requests for use with AJAX webservice calls.

Hope this helped clear things up.


thnx aquillin.

When I was not using the above code , I was getting error like "sys is undefined".
Yesterday I was reading an article and it said that the code generates the required javascript as AJAX uses it.

you said "All this does is tell the webserver that when it gets a request for an.asmx page, to use the System.Web.Script.Services.ScriptHandlerFactory...........,"

I have one dought that what is the link of .asmx (asp.net web services here). I am not using any web service .

Am i using them as hidden ?


The code actually doestwo things. One is the handling of .asmx web services. The other is handling of calls to ScriptResource.axd. That's required to deliver the Microsoft AJAX Library to the client.

It shouldn't affect your application unless for some reason you were already using something called ScriptResource.axd (extremely unlikely, but just being complete).

No comments:

Post a Comment