[英]ASP.NET / VB.NET - What is the equivalent of $_REQUEST of PHP in ASP.NET?
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? 我只是想知道,是否有一种方法可以在ASP.NET的一个函数或
Collection
中获取GET
参数和POST
参数? Like using $_REQUEST
in PHP? 喜欢在PHP中使用
$_REQUEST
吗? I'm using VB.NET. 我正在使用VB.NET。
Request["VariableName"]
(in C#) and Request("VariableName")
(in VB) should work. Request["VariableName"]
(在C#中)和Request("VariableName")
(在VB中)应该可以正常工作。
See HttpRequest.Item
indexer : 参见
HttpRequest.Item
索引器 :
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.如果找不到指定的键,则返回
null
。
Note: 注意:
Request["xyz"]
gets it from cookies, querystring, form, or server variables Request["xyz"]
从Cookie,查询字符串,表单或服务器变量中获取
Request.Parameters["xyz"]
does the same Request.Parameters["xyz"]
执行相同的操作
Request.QueryString["xyz"]
is just the querystring Request.QueryString["xyz"]
只是查询字符串
Request.Form["xyz"]
is just the form Request.Form["xyz"]
只是表格
Sure is: Request.QueryString
for GET, Request.Form
for POST. 肯定的是:
Request.QueryString
为GET, Request.Form
为POST。 You can specify a name to extract, ie Request.QueryString("id")
, to get the "id" from the URL. 您可以指定要提取的名称,即
Request.QueryString("id")
,以从URL中获取“ id”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.