HTTP stands
for Hypertext Transfer Protocol.
Http is the most common protocol used for the communication between a web
server and a client.
For Example,
to request a home page of any site, then you would type the url of that site.
Data is submitted as a part of url.
It is not secure but fast and quick.
It is good when you want user to bookmark page.
Data is limited to max length of query string.
GET method should not be used when sending passwords or other sensitive information.
It use Stack method for passing form variable.
Get Request is
generally used to get the data from the server
- When you click on a hyperlink
- When Response.Redirect() statement is executed
- When you type URL in the address bar and hit enter
Example : Now i want to submit the data.
Login.aspx:
Output:
On Clicking on button
In Url you can see the values:
Output Explanation: Default.aspx has username
data which is sent using get method to login.aspx (server).
In the output
of second screen shot we can see there is key (username) value(uday) data as
query stirng in the URL which is submitted to login.aspx page and the output(Welcome
uday) is show in login.aspx page.POST
Data is submitted in
http request body.
It is more
secured but slower as compared to GET.
It use heap method
for passing form variable
It can post unlimited
form variables.
Data is not visible
in the url.
Example:
Default.aspx
Example:
Default.aspx
Output:
Output Explanation
we can observe the post method did not send any query string like what we have seen in get method
Post Request is generally used to submit data to the server.
- A post request is generally issued
- When you click on submit button
- When AUTOPOST back is set to true and when a selection in the Drop Down List is changed
Now with in the button click we are retrieving the details the
user has submitted , and then we are appending the values the user has entered
using query string and redirecting to webform2
When we are typing the URL and hitting Enter this is GET Request
Now I want to check in Fiddler Web Debugger and check the Type of
Request
After Filling the Form Values:
And Then Clicking on Submit Btn
On Clicking on Submit Button then We are Posting the Data
Here the data is send to the server as part of the Body.
Note:
In asp.net Web Forms, IsPostBack page property is used to check if the request is
POST or GET.
If IsPostBack Property returns true, then we knows the request
is http post. Else the request is GET
GET
|
POST
|
Data will be
arranged in HTTP header by appending to the URL as query string
|
Data will be
arranged in HTTP message body.
|
Data is in query
string so user can view the data
|
Not visible to user
|
Less secured
compared to POST method because data is in query string so it will be saved
in browser history and web server logs
|
Bit safer than GET
method because data is not saved in history or web server logs
|
As data is saved in
URL so its saves only 2048 bytes data
|
Can be used for any
amount of data
|
Can be bookmarked
|
Can’t bookmarked
|
Hacking will be easy
|
Hacking is difficult
|
Only ASCII character
data type allowed
|
No restrictions.
Allows binary data also
|
Caching is possible
|
No caching
|
No comments:
Post a Comment
Thank you for visiting my blog