我有两个页面WebForm1.aspx和 WebForm2.aspx
当我运行WebForm1.aspx ,点进入WebForm2.aspx页面,再从WebForm2.aspx返回上一页时,出现IE地址栏为http://localhost/精通aspnet实例/sdk/dynamiusecontrols/WebForm2.aspx 而我采用断点运行,发现url 值为"http%3a%2f%2flocalhost%2f%cd%a8aspnet%ca%b5%2fsdk%2fdynamiusecontrols%2fWebForm1.aspx"
url是WebForm1.aspx而地址栏为WebForm2.aspx
为什么呢?
代码如下:webform2.aspxprivate void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(! IsPostBack)
{
if(Request.UrlReferrer != null)
{
ViewState["URLreferrer"]=Request.UrlReferrer.ToString();
}
}

} private void LinkButton1_Click(object sender, System.EventArgs e)
{
if(ViewState["URLreferrer"]!=null)
{
string url=Server.UrlEncode(ViewState["URLreferrer"].ToString()).ToString();
Response.Redirect(url);
}
}