当前位置 主页 > 服务器问题 > win服务器问题汇总 >

    Global.asax取物理路径/取绝对路径具体方法

    栏目:win服务器问题汇总 时间:2019-12-01 22:23

    虚拟路径
    复制代码 代码如下:
    Server.MapPath("~/") 取得的就是虚拟路径

    取绝对路径
    复制代码 代码如下:
    string absolutelyPath =AppDomain.CurrentDomain.BaseDirectory;

    取物理路径和应用程序路径

    复制代码 代码如下:
    System.Web.HttpContext.Current.Request.ApplicationPath