源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

获取根目录的URL例如http://localhost:51898

  • 时间:2020-02-18 08:58 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:获取根目录的URL例如http://localhost:51898
[u]复制代码[/u] 代码如下:
public static string GetRootURI() { string AppPath = ""; HttpContext HttpCurrent = HttpContext.Current; HttpRequest Req; if (HttpCurrent != null) { Req = HttpCurrent.Request; string UrlAuthority = Req.Url.GetLeftPart(UriPartial.Authority); if (Req.ApplicationPath == null || Req.ApplicationPath == "/") //直接安装在 Web 站点 AppPath = UrlAuthority; else //安装在虚拟子目录下 AppPath = UrlAuthority + Req.ApplicationPath; } return AppPath; }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部