只是知道要是需要更改URL,先编码,再加入你要添加的字符串,用之前再解码。
URL 编码确保所有浏览器均正确地传输 URL 字符串中的文本。在某些浏览器中,像 ?、&、/ 和空格这样的字符可能会被截断或损坏,因此这些字符不能在 ASP.NET 页的 <A> 标记或查询字符串中使用,在查询字符串中进行编码时,浏览器会以请求字符串的形式重新发送这些字符串。
因此,在我们需要传输URL地址时,就需要进行编码。
注参考其它人的
private void Button1_Click(object sender, System.EventArgs e)
{
String Message = Server.UrlEncode("欢迎学习ASP.NET!");
Response.Redirect("WebForm2.aspx?Msg=" + Message);
}
private void Page_Load(object sender, System.EventArgs e)
{
Label1.Text = Server.UrlDecode(Request.QueryString["Msg"]);
}