方法一:
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