public static string CurrentWebPathLink
{
get
{
return "http://" + HttpContext.Current.Request.ServerVariables["Http_Host"] +HttpContext.Current.Request.ApplicationPath;
}
}
{
get
{
return "http://" + HttpContext.Current.Request.ServerVariables["Http_Host"] +HttpContext.Current.Request.ApplicationPath;
}
}
public static string CurrentWebPathLink
{
get
{
return "http://" + HttpContext.Current.Request.ServerVariables["Http_Host"] +HttpContext.Current.Request.ApplicationPath;
}
}
{
get
{
return "http://" + HttpContext.Current.Request.ServerVariables["Http_Host"] +HttpContext.Current.Request.ApplicationPath;
}
}
1 public static string CurrentWebPathLink
2 {
3 get
4 {
5 return "http://" + HttpContext.Current.Request.ServerVariables["Http_Host"] +HttpContext.Current.Request.ApplicationPath;
6 }
7 }
2 {
3 get
4 {
5 return "http://" + HttpContext.Current.Request.ServerVariables["Http_Host"] +HttpContext.Current.Request.ApplicationPath;
6 }
7 }
本文介绍了一种在ASP.NET中获取当前网站完整URL的方法,通过使用HttpContext对象的Request属性,结合ServerVariables集合与ApplicationPath属性,可以动态地构建出当前请求的完整链接。
1003

被折叠的 条评论
为什么被折叠?



