When you make a web service call from the browser via the ASP.NET AJAX Frame work,it uses XML HTTP to make a call to a server-side web service. Usually all calls to ASMX files are handled by ASP.NET’s ASMX handler. But when you add ASP.NET AJAX to your web application, you need to make some changes in the web. config where you explicitly remove the default ASMX handler and add the ASP.NET AJAX Frame work’s own Script Handler as the ASMX handler (see Example).
ASP.NET AJAX handles all calls to ASMX
You also add a Script Module in the HTTP modules pipeline. It intercepts each and every HTTP request and checks whether the call is to an ASPX page and is calling a page method. It intercepts only page method calls,not web service calls.So, you don’t need to bypass it.
Script Handler is a regular HTTP handler that finds out which web service and web method is called by parsing the URL.It then executes the web method by reflecting on the web service type.The steps involved in calling a web method are as follows:
To add asynchronous web method call support, you need to first change the way it reflects on the assembly and locates the web method. It needs to call the Begin and End pair, instead of the real web method.You also need to make the handler implement the IHttp Async Handler interface and execute the Begin and End pair in Begin Process Request and End Process Request.But there’s no step that facilitates .NET 2.0 transactions.The only way to implement them is to use System.Enter prise Services transactions or use your own .NET 2.0 Transaction Scope class inside your web method code..NET 2.0 introduced the new System.Transaction name space, which has a much better way to handle transactions. It would be great if you could add a [Transaction] attribute in your web methods so they could work within a transaction managed by the Script Handler.But Script Handler does not deal with .NET 2.0 transactions.
Initializing the Cache Policy
In the ASP.NET AJAX Framework,initialization of cache policy comes before invoking the web method.Example shows the ASP.NET AJAX 1.0 code for the Initialize Cache Policy function that sets the cache policy before invoking the web method.
Script Handler’s Initialize Cache Policy function initializes the cache settings before the web method is called
ScriptHandler’s InitializeCachePolicy function initializes the cache settings before the web method is called (continued)
If you do not have cache duration set in the [Web Method] attribute, it will set the Max Age to zero.Once Max Age is set to zero, it can no longer be increased; there fore, you can not increase Max Age from your web method code dynamically and thus make the browser cache the response.
ASP.NET Related Interview Questions
|VB.NET Interview Questions||C#. NET Interview Questions|
|ASP.NET Interview Questions||ADO.Net Interview Questions|
|Windows Presentation Foundation(WPF) Interview Questions||Windows CE .NET Interview Questions|
|Dot Net Framework Interview Questions||Asp Dot Net Mvc 4 Interview Questions|
|Asp Dot Net Mvc Interview Questions|
Introducing Web Portals And Dropthings.com
Architecting The Web Portal And Widgets
Building The Web Layer Using Asp.net Ajax
Building The Data And Business Layers Using .net 3.5
Building Client-side Widgets
Optimizing Asp.net Ajax
Creating Asynchronous, Transactional, Cache-friendly Web Services
Improving Server-side Performance And Scalability
Improving Client-side Performance
Solving Common Deployment, Hosting, And Production Challenges
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.