Reputation: 65147
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?
Upvotes: 4
Views: 13743
Reputation: 22443
You probably want Request.Form
for your form data. Request.QueryString
will always be the querystring (stuff after the question mark in the URL).
Upvotes: 2
Reputation: 73112
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.
Upvotes: 16