这次做一程序要取IE的地址,才开始一直有问题,总算做出来了,现在把代码给分享下.
protected string GetUrl()
{
//取本页URL地址
string strTemp="";
if(Request.ServerVariables["HTTPS"] == "off")
{
strTemp = "http://";
}
else
{
strTemp = "https://";
}
strTemp = strTemp + Request.ServerVariables["SERVER_NAME"];
if(Request.ServerVariables["SERVER_PORT"] != "80")
{
strTemp = strTemp + ":" + Request.ServerVariables["SERVER_PORT"];
}
strTemp = strTemp + Request.ServerVariables["URL"];
if(Request.QueryString != null)
{
strTemp = strTemp + "?" + Request.QueryString;
}
return strTemp;
}
string myurl = GetUrl();