作者: htynkn

  • Asp.net 获取当前目录的三种方法

    方法一:

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

    方法二:

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

    方法三:

    string sPath = Page.Server.MapPath(“/“);

    我推荐使用第二种

    有时候可能出现找不到类的情况,请引用System.Web.dll…