指引网

当前位置: 主页 > 编程开发 > .NET >

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

来源:网络 作者:佚名 点击: 时间:2017-11-17 02:01
[摘要] 本文章来给大家简单介绍利用Global.asax取物理路径和取绝对路径代码,有需要了解的朋友可参考参考

虚拟路径

代码如下:

Server.MapPath("~/") 取得的就是虚拟路径

取绝对路径

代码如下:

string absolutelyPath =AppDomain.CurrentDomain.BaseDirectory;

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

代码如下:

System.Web.HttpContext.Current.Request.ApplicationPath

------分隔线----------------------------