Reputation: 30163
I'm just wondering, is there a way to get the GET
parameters and POST
parameters in just one function or Collection
in ASP.NET? Like using $_REQUEST
in PHP? I'm using VB.NET.
Upvotes: 2
Views: 2507
Reputation: 30162
Note:
Request["xyz"]
gets it from cookies, querystring, form, or server variables
Request.Parameters["xyz"]
does the same
Request.QueryString["xyz"]
is just the querystring
Request.Form["xyz"]
is just the form
Upvotes: 1
Reputation: 422320
Request["VariableName"]
(in C#) and Request("VariableName")
(in VB) should work.
Name-value pairs are returned in the following order:
- Query-string parameters.
- Form fields.
- Cookies.
- Server variables.
If the specified key is not found, then
null
is returned.
Upvotes: 3
Reputation: 8767
Sure is: Request.QueryString
for GET, Request.Form
for POST. You can specify a name to extract, i.e. Request.QueryString("id")
, to get the "id" from the URL.
Upvotes: 0