zoukankan      html  css  js  c++  java
  • 获取根目录的URL的方法(asp.net)

    每天积累一点点,

    一、获取获取根目录的URL的方法

    #region 获取本页根目录URL
    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;
    }
    #endregion

    二、获取全URL

    IN_URL = Request.Url.ToString();

    希望积少成多,水滴石穿!

  • 相关阅读:
    咨询
    xcode技巧
    礼仪
    asi 网络框架
    iOS 开发问题 书籍 价值 改名 创业大赛app
    PS,UI,美工
    运营推广
    多线程 并发 文章
    手机技巧 文章
    javaScript 类文章
  • 原文地址:https://www.cnblogs.com/JBlogs/p/3714237.html
Copyright © 2011-2022 走看看