Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在ASP.Net中使用查询字符串在网页标签中显示检索到的值?_Asp.net_Query String - Fatal编程技术网

如何在ASP.Net中使用查询字符串在网页标签中显示检索到的值?

如何在ASP.Net中使用查询字符串在网页标签中显示检索到的值?,asp.net,query-string,Asp.net,Query String,我正在编写一个web应用程序,从一个网页的文本框中检索一个值,并将其显示在另一个网页的标签中。我编写了一个从一个网页检索的代码,但我不知道如何在另一个网页中显示检索到的值。 这是密码 //This is the code in first web page if (AuthenticateUser(Textusertbl1.Text, textpastbl1.Text)) { FormsAuthentication.SetAuthCookie(Textusertbl1.Text, Ch

我正在编写一个web应用程序,从一个网页的文本框中检索一个值,并将其显示在另一个网页的标签中。我编写了一个从一个网页检索的代码,但我不知道如何在另一个网页中显示检索到的值。 这是密码

//This is the code in first web page
if (AuthenticateUser(Textusertbl1.Text, textpastbl1.Text)) 
{
    FormsAuthentication.SetAuthCookie(Textusertbl1.Text, CheckBoxtbl1.Checked); 
    Response.Redirect("~/WelcomeStaff.aspx?myname=" + Server.UrlEncode(Textusertbl1.Text));
}
//This is code in 2nd web page.On the page load I need to display this retrieved values in a label      
protected void Page_Load(object sender, EventArgs e) 
{
    string myname = Server.UrlDecode(Request.QueryString["myname"]);
}

有人能告诉我如何在标签中显示文本吗?我是.Net新手。请提供帮助。如果页面上有ID为“MyLabel”的标签,请提前感谢


这将在变量赋值后立即进入页面加载

我修改了代码WelcomeUsername.Text=Request.QueryString[“label”].ToString();这对我很有效。!!非常感谢你花时间回答我的问题@trnelson@anusha不客气!请确保在写入页面之前也检查了输入(针对用户的空输入和恶意输入)。另外,如果我的答案是有用的,请考虑把它标记为答案。祝你一切顺利。
MyLabel.Text = myname;