ASP.NET AJAX, by default,uses HTTP POST for all web service calls, but HTTP POST is more “ expensive” than HTTP GET.It transmits more bytes over the wire,which hogs precious network time, and makes ASP.NET AJAX do extra processing on the server end.So, you should use HTTP GET as much as possible.However, HTTP GET does not allow you to pass objects as parameters, only numerics,strings,and dates.
When you make an HTTP GET call,ASP.NET AJAX builds an encoded URL and hits that URL.So, you can’t pass too much content that makes the URL larger than 2,048 characters.This is the maximum length for URLs in many browsers.
To enable HTTP GET on a web service method, you need to decorate the method with the [ScriptMethod(UseHttpGet=true)] attribute:[WebMethod] [Script Method (UseHttpGet=true)]
Another problem of POST versus GET is that POST makes two network transfers.When you first make a POST, the web server sends an “HTTP 100 Continue” message, which means that the web server is ready to accept the content.After that, the browser sends the actual data.So,initiation of a POST request takes more time thanGET.And network latency (the roundtrip time between your computer and the server) is the biggest concern with Ajax applications because Ajax makes many small calls that need to be done in milliseconds or the application won’t feel smooth and the user is annoyed.
Ethereal is a nice tool that shows what happens under thehood on POST and GET calls (see Figure ).
HTTP POST and GET calls viewed in a packet tracer
You can see that POST requires a confirmation from the web server— "HTTP/1.1 100 Continue" —before sending the actual data.After that,it transmits the data. However, GET transmits the data without waiting for any confirmation.So, you should use HTTP GET when downloading data from a server including parts of pages,contents in a grid, or a block of text, etc.But you should not use HTTP GET to send data, such as user name submissions, pass words, or anything that will make the URL exceed the 2,000 character limit, to a server.
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.