whats is the diffrence between http get and http post in mvc

Posted by Kishore22 under ASP.NET MVC on 12/12/2013 | Points: 10 | Views : 13457 | Status : [Member] | Replies : 3
what is the difference between http get and http post in mvc




Responses

Posted by: Sourav.Kayal on: 12/12/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
HttpGet and HttpPost attributes we can specify on action in MVC application. If we specify [HttpGet] attribute on action then this action can able to access only by GET method. Same is true for [HttpPost] attribute.

Read my blog here
http://ctrlcvprogrammer.blogspot.in/

Kishore22, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sheonarayan on: 12/12/2013 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
HttpPost is used to receive data from the client using Post method of the html form while HttpGet is used to receive data from the client using Get method of the html form (in this case the data is sent to the server using querystring along with the url).

When you are using HttpPost, you can get the form fields value using Request.Form["formElementName"] .

In HttpGet, you can get the querystring value using Request.QueryString["querystringname"]

Hope this helps.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Kishore22, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ring on: 12/12/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,
HTTP GET - Requests a representation of the specified resource. Get Should only retrieve data and have no other effect. Only a URL and headers are sent to the server,

HTTP POST - Submits Data to be processed Eg from an HTML form to the identified resource. The data is included in the body of the request. Post method is used when the client needs to send data to the server as part of the request, such as when uploading a file or submitting a completed form.
Also video here:
http://www.youtube.com/watch?v=Un2JTC7tFPI

Kishore22, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response