Friday, January 21, 2011

Difference Between Get and Post

get and post are HTTP methods that are used to send request to the server.Difference of them are listed below.

Get() transfer only 256 char. While there is no limit for post.

Get is not Secure information appear in browser, Post is secure.And information does not appear in the browser

As the data transfers through address bar (URL) there are some restrictions in using space, some characters like ampersand (&) etc in the GET method of posting data. We have to take special care for encoding data if such special characters are present. While in post there is no restriction.

If get method is used and if the page is refreshed it would not prompt before the request is submitted again. while in case of post it will prompt to user.

One can store the name value pairs as bookmark and directly be used while sharing with others - example search results.While in Post method bookmark can not be save.

It is a single call system While Post is a two call system.

Data transmission is faster in get while in post data transmission is slow.

In get data is always submitted in the form of text in get method. In Post data is submitted in the form as specified in encrypt attribute of form tag and thus files can be used in FileUpload input box.

If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST.

In ASP .Net Response.Redirect use get method while using Server.Transfer use post method.

No comments: