Forums » .NET » .NET »

what is difference b/w get and post method in asp.net?


Posted Date: 30 Mar 2007      Posted By:: Balaya     Member Level: Gold    Member Rank: 484     Points: 2   Responses: 6



what is difference b/w get and post method in asp.net?



Responses

#116500    Author: Ramprathap      Member Level: Silver      Member Rank: 0     Date: 30/Mar/2007   Rating: 2 out of 52 out of 5     Points: 2

Get - Creats a Query string collection(did not store URL History, Data r visible in URL)
Post - Creates a Form Collection(Stroe URL history, Data r not visible in URL)


 
#116520    Author: Manikandan Balakrishnan      Member Level: Gold      Member Rank: 0     Date: 30/Mar/2007   Rating: 2 out of 52 out of 5     Points: 2

Get:
Sends values through the URL, we can use BACK, FORWARD of the IE, it wont give any warning, because all values stored in the URL, it will be in the history.

Post:
Values posting through form object, we can’t see the values in URL, also if we click BACK or FORWARD, it fill give the warning message, (like do you want to resend the values again?)


 
#116521    Author: Manikandan Balakrishnan      Member Level: Gold      Member Rank: 0     Date: 30/Mar/2007   Rating: 2 out of 52 out of 5     Points: 2

Get:
There is a limitation while sending the data; we can’t send very huge data, because the URL can not carry huge data.

Post:
We can send very huge data, because no URL is used.





 
#116578    Author: Manu Gupta      Member Level: Bronze      Member Rank: 0     Date: 30/Mar/2007   Rating: 2 out of 52 out of 5     Points: 2

Post and Get are the two main methods used in passing requests from the browser to the web server.

By default GET Method is used, meaning that all the information that needs to be sent about the resource is sent via the URL (and appears in the location bar of your browser). Any additional values - like field values are sent as name/value pairs appended to the end of the URL.

Example :The Google search engine is a good eg of using GET method sending name value pairs: http://www.google.com/search?q=HTML+.Net this gives us a search result of pages matching the search request "HTML .Net").

POST method on the other hand has only the URL of the page requested in the location bar, but it sends all other information - like field values, in the body of the [http request].


 
#116580    Author: Manu Gupta      Member Level: Bronze      Member Rank: 0     Date: 30/Mar/2007   Rating: 2 out of 52 out of 5     Points: 2

If we submit GET request multiple times, then we get the same results back which is is called an idempotent request.

Where as with a POST request, the results can be different each time.

Both POST and GET method can be used in form submission,but below are the few points to rem.


1st How much data (name/value pairs) are we sending? GET has a limited length (some browsers as low as 256 bytes), POST has no restrictions other than the time a request takes to timeout on the users browser.

2nd How sensitive is the data? GET stores the field values in name/value pairs in the URL, so if there's data you don't want there, use a POST instead. (Beware, this doesn't mean it is safe to send credit card numbers using a post method on an unsecure connection - POST doesn't encrypt. SSL is mandatory for this sort of data).

3rd. How useful would it be to link to the results of a request? If you want to allow people to bookmark the results of a request, then use a GET method (all good search engines use get for their request forms).
Is one of the fields a file/ are you uploading a file? Use a POST.


 
#116685    Author: Sriman N Vangala      Member Level: Gold      Member Rank: 117     Date: 01/Apr/2007   Rating: 2 out of 52 out of 5     Points: 2

Get and Post are methods used to send data to the server With the Get method, the browser appends the data onto the URL. With the Post method, the data is sent as "standard input." The Get method is the default, so if you do not specify a method, the Get method will be used automatically. The Get method has several disadvantages: There is a limit on the number of characters which can be sent to the server, generally around 100 - 150 characters. Your user will see the "messy codes" when the data is sent. The Bottom Line is With the Get method, your users will see the "messy codes" in the Location box when they submit a form. With the Post method, they won't Use GET: - during development for debugging purposes - if you want your visitors to be able to bookmark the submitted pages - if you want to refer to submitted pages using hyperlinks Use POST: - for forms with password fields - for large forms or forms with large text fields

 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : what is httpcontext?
Previous : how to get system date on sql
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages

Subscribe to Subscribers
Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John

Online Members

YOGESH TAYADE
More...
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India