我不能在 QueryString 中传递一个以上的值
I cannot pass more than one value in QueryString
我的 ASP.NET 应用程序在我将其迁移到另一台服务器后停止工作。
问题是我无法通过查询字符串发送多个值。
我正在尝试的 URL 看起来像这样:
ThisIsSecondPage.aspx?Mode=Edit&ID=0001
我可以在ThisIsSecondPage.aspx中捕获Mode的值,但是ID 为空。
我也尝试将 ID 更改为行 A0001,但没有成功。
我也试过:
ThisIsSecondPage.aspx?Mode=Edit<and>ID=0001
谁能帮帮我?
像这样发送查询字符串
ThisIsSecondPage.aspx?Mode=Edit&ID=0001
并在 This Second Page 页面的 page_load 事件中接收:
protected void Page_Load(object sender, EventArgs e)
{
string ModeParam = "";
string IDparam = "";
if(Request.Params["Mode"] !=null)
ModeParam = Request.Params["Mode"].ToString();
if (Request.Params["ID"] != null)
IDparam = Request.Params["ID"].ToString();
}
您正在正确传递查询字符串。
ThisIsSecondPage.aspx?Mode=Edit&ID=0001
在第二页,使用如下
适合模式
string ModeValue = Request.QueryString["Mode"];
或简称,
string ModeValue = Request["Mode"];
身份证
string IDValue = Request.QueryString["ID"];
或简称,
string IDValue = Request["ID"];
我的 ASP.NET 应用程序在我将其迁移到另一台服务器后停止工作。
问题是我无法通过查询字符串发送多个值。
我正在尝试的 URL 看起来像这样:
ThisIsSecondPage.aspx?Mode=Edit&ID=0001
我可以在ThisIsSecondPage.aspx中捕获Mode的值,但是ID 为空。
我也尝试将 ID 更改为行 A0001,但没有成功。
我也试过:
ThisIsSecondPage.aspx?Mode=Edit<and>ID=0001
谁能帮帮我?
像这样发送查询字符串
ThisIsSecondPage.aspx?Mode=Edit&ID=0001
并在 This Second Page 页面的 page_load 事件中接收:
protected void Page_Load(object sender, EventArgs e)
{
string ModeParam = "";
string IDparam = "";
if(Request.Params["Mode"] !=null)
ModeParam = Request.Params["Mode"].ToString();
if (Request.Params["ID"] != null)
IDparam = Request.Params["ID"].ToString();
}
您正在正确传递查询字符串。
ThisIsSecondPage.aspx?Mode=Edit&ID=0001
在第二页,使用如下
适合模式
string ModeValue = Request.QueryString["Mode"];
或简称,
string ModeValue = Request["Mode"];
身份证
string IDValue = Request.QueryString["ID"];
或简称,
string IDValue = Request["ID"];