asp.net中的POST参数
我试图从表单中获取参数,这些参数是通过方法POST发送的 我不知道它在asp中是怎么叫的,M$喜欢改变东西的名字来搞乱我们。它们位于HTTP正文中,而GET/QueryString参数位于URL中,位于?签字 在PHP中,asp.net中的POST参数,asp.net,visual-studio-2012,request.querystring,querystringparameter,Asp.net,Visual Studio 2012,Request.querystring,Querystringparameter,我试图从表单中获取参数,这些参数是通过方法POST发送的 我不知道它在asp中是怎么叫的,M$喜欢改变东西的名字来搞乱我们。它们位于HTTP正文中,而GET/QueryString参数位于URL中,位于?签字 在PHP中,$\u get数组中提供了“get参数”。在asp中,它们是Request.QueryString[“parameter1”] “post参数”在$\u post中,我在asp中找不到它。我希望我已经讲清楚了:p要从表单数据中包含的paramate1读取值: string pa
$\u get
数组中提供了“get参数”。在asp中,它们是Request.QueryString[“parameter1”]
“post参数”在
$\u post
中,我在asp中找不到它。我希望我已经讲清楚了:p要从表单数据中包含的paramate1
读取值:
string paramater1 = Request.Form["paramater1"];
请注意,如果表单不包含变量,
paramater1
将为null
,以从表单数据中包含的paramater1
读取值:
string paramater1 = Request.Form["paramater1"];
请注意,如果表单不包含您的变量,
paramater1
将为nullTryRequest.Params
,它应该包含所有GET和/或POST参数,Request.form
应该只包含表单参数。TryRequest.Params
,它应该包含所有GET和/或POST参数,请求。表单
应仅包含表单参数。假设您的查询字符串如下:
http://stackoverflow.com/questions.aspx?id=17844065&title=post-parameters-in-asp-net
如果我是对的,那么你正在寻找这个。请注意,这是关于ASP.Net的,我不知道经典的ASP。我相信这在经典ASP上是行不通的
你可以在cs中使用
if(Request["id"]!=null )
{
var id= Request["id"]; // gives you id as 17844065 string values
}
if(Request["title"]!=null )
{
var title= Request["title"]; // gives you title as string
}
更新:
NameValueCollection nvc = Request.Form;
string userName, password;
if (!string.IsNullOrEmpty(nvc["txtUserName"]))
{
userName = nvc["txtUserName"];
}
if (!string.IsNullOrEmpty(nvc["txtPassword"]))
{
password = nvc["txtPassword"];
}
假设您的查询字符串如下所示:
http://stackoverflow.com/questions.aspx?id=17844065&title=post-parameters-in-asp-net
如果我是对的,那么你正在寻找这个。请注意,这是关于ASP.Net的,我不知道经典的ASP。我相信这在经典ASP上是行不通的
你可以在cs中使用
if(Request["id"]!=null )
{
var id= Request["id"]; // gives you id as 17844065 string values
}
if(Request["title"]!=null )
{
var title= Request["title"]; // gives you title as string
}
更新:
NameValueCollection nvc = Request.Form;
string userName, password;
if (!string.IsNullOrEmpty(nvc["txtUserName"]))
{
userName = nvc["txtUserName"];
}
if (!string.IsNullOrEmpty(nvc["txtPassword"]))
{
password = nvc["txtPassword"];
}
这是关于获取参数的。我需要POST参数。这是关于获取参数的。我需要帖子参数。明天我将尝试所有建议,非常感谢!明天我会尝试所有的建议,非常感谢!