Asp.net获取当前目录的方法小结
来源:动视网
责编:小采
时间:2020-11-27 22:40:40
Asp.net获取当前目录的方法小结
Asp.net获取当前目录的方法小结:方法一: string sPath = System.IO.Path.GetDirectoryName(Page.Request.PhysicalPath) 方法二: string sPath = System.Web.HttpContext.Current.Request.MapPath(/) 方法三: string sPath = Page
导读Asp.net获取当前目录的方法小结:方法一: string sPath = System.IO.Path.GetDirectoryName(Page.Request.PhysicalPath) 方法二: string sPath = System.Web.HttpContext.Current.Request.MapPath(/) 方法三: string sPath = Page

方法一:
string sPath = System.IO.Path.GetDirectoryName(Page.Request.PhysicalPath)
方法二:
string sPath = System.Web.HttpContext.Current.Request.MapPath("/")
方法三:
string sPath = Page.Server.MapPath("/");
我推荐使用第二种
Asp.net获取当前目录的方法小结
Asp.net获取当前目录的方法小结:方法一: string sPath = System.IO.Path.GetDirectoryName(Page.Request.PhysicalPath) 方法二: string sPath = System.Web.HttpContext.Current.Request.MapPath(/) 方法三: string sPath = Page