UrlReferrer:是一个Uri对象
default1.aspx中的按钮事件:
Response.Redirect("default2.aspx", false);
在default2.aspx页面的page_load事件中:
string str = Request.UrlReferrer.AbsolutePath; //获取Uri的绝对路径
string str1 = Request.UrlReferrer.Authority; //获取IP地址
string str2 = Request.UrlReferrer.AbsoluteUri; //获取绝对的Uri
Uri MyUrl = Request.UrlReferrer;
Response.Write("Referrer URL Port: " + Server.HtmlEncode(MyUrl.Port.ToString()) + "<br>"); //端口
Response.Write("Referrer URL Protocol: " + Server.HtmlEncode(MyUrl.Scheme) + "<br>"); //协议
Response.Write(str+"-"+str1+"-"+str2);