这个函数可以得到http://localhost/

来源:互联网 发布:企业管理论文选题 知乎 编辑:程序博客网 时间:2024/06/06 17:48
private string GetBaseURL()//这个函数可以得到http://localhost/
{
if (HttpContext.Current.Request.ApplicationPath == "/")
{
return @"http://" + HttpContext.Current.Request.Url.Host;
}
else
{
return @"http://" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath;
}
}
0 0
原创粉丝点击