Get Querystring from HTTP POST?

This code seems to be receiving a request from HTTP Get ...

HttpContext.Current.Request.QueryString.ToString(); 

How to receive a request from HTTP POST?

+4
source share
3 answers

Same.

 HttpContext.Current.Request.QueryString["somekey"] 

Both GET and POST have a request in the request. Only POST has form data.

You should not do QueryString.ToString() . This will evaluate ALL keys in the NameValueCollection. You must use the index to obtain the desired key or enumeration using the Keys property.

+15
source

You probably want Request.Form for your form data. Request.QueryString will always be querystring (the material after the question mark in the URL).

+3
source

The code works for all HTTP verbs.

0
source

All Articles