Wednesday, August 17, 2016

HTTP GET and HTTP Post

Hypertext Transfer Protocol (HTTP)

  • common protocol used for communication between web server and client(PC Browser).
  • Default port 80
  • Stateless
    • After request, server and client will forget each other, it will not remember the previous request
    • so state management will help (session, cookies)

HTTP Method : GET and POST

GET Request - get data from web server, by :
  • Click on a hyperlink
  • Response.Redirect()
  • Type URL
POST Request - submit data to the server, by :
  • Click a Submit button.
  • AutoPostback when drop down is changed.
IsPostback to check the request either Get(false) or POST(true).

GET
POST
Append data into URL.
Append data into message body.
Use for fetching data.
Use for process data.
Has length restriction, URL length maximum is 2048 characters
No length restriction.
Less Secure, data sent is part of URL.
More secure. No Logs or browser history can get
Not suitable for sensitive information (e.g. password)
Suitable for sensitive information.
Can Cache.
Not Cache.

HEAD
  • Same as GET, but it response the status line and the header section only. 
  • No body.
PUT 
  • Replace all the current representations of the target resource with the uploaded content.
  • Request server to store the entire body at location specified by the given URL.
DELETE 
  • Delete a file at location specified by the given URL.
CONNECT 
  •  Establish a network connection to web server over HTTP.
OPTIONS 
  • client use it to find out the HTTP methods and other options support by a web server.
  • client can specify a URL for the OPTIONS method, or * to refer to the entire server.
TRACE 
  • Perform a message loop back test along with the path to the target resource.
  • to echo the contents of an HTTP Request back to the requester which can be used for debugging purpose at the time of development.

No comments:

Post a Comment