网络编程 
首页 > 网络编程 > 浏览文章

Asp.net获取当前目录的方法小结

(编辑:jimmy 日期: 2026/3/6 浏览:3 次 )

方法一:

string sPath = System.IO.Path.GetDirectoryName(Page.Request.PhysicalPath)

方法二:

string sPath = System.Web.HttpContext.Current.Request.MapPath("/")                                         

方法三:
string sPath = Page.Server.MapPath("/");

我推荐使用第二种

上一篇:将.aspx转换为.htm的两种方法
下一篇:服务端拼接json数据格式的正确写法(Append方式)