Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Querystring from HTTP POST?

This code seems to be getting the querystring from a HTTP Get...

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

How do I get the querystring from a HTTP POST?

like image 711
001 Avatar asked Dec 02 '22 01:12

001


1 Answers

The same way.

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

Both GET and POST have querystring in the Request. Only POST has the form data.

You shouldn't be doing QueryString.ToString(). That will evaluate ALL the keys in the NameValueCollection. You should be using the indexer to retrieve the key you want, or enumerating with the Keys property.

like image 166
RPM1984 Avatar answered Dec 21 '22 16:12

RPM1984