您现在的位置是:网站首页> 编程资料编程资料

Asp.net获取当前目录的方法小结_实用技巧_

2023-05-24 363人已围观

简介 Asp.net获取当前目录的方法小结_实用技巧_

方法一:

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

方法二:

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

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

我推荐使用第二种

-六神源码网