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

网络编程 2021-07-04 22:40www.168986.cn编程入门
本文章来给大家简单介绍利用Global.asax取物理路径和取绝对路径代码,有需要了解的朋友可参考参考

虚拟路径

代码如下:

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

取绝对路径

代码如下:

string absolutelyPath =AppDomain.CurrentDomain.BaseDirectory;

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

代码如下:

System.Web.HttpContext.Current.Request.ApplicationPath

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by