HttpContext.Current.Request.PhysicalPath; Gets the full physical path of the current page. For example,
F:\XFU. Nsqs\project\website\default.aspx
HttpContext.Current.Request.PhysicalApplicationPath; Gets the physical path of the current program running
such as F:\XFU. Nsqs\project\website\
HttpContext.Current.Server.MapPath (@ "\"); This is the MapPath in the page. Same usage
Httpruntime.appdomainapppath//This is new found, very useful.
Another is used to handle calling DLL files in ASP. dll files if you want to know the working directory of the current Web site can be
To use
System.AppDomain.CurrentDomain.BaseDirectory
The physical path of the Web site on the server disk: Httpruntime.appdomainapppath
Virtual Program path: Httpruntime.appdomainappvirtualpath
HttpContext.Current.Request.ApplicationPath Virtual Application root Path
HttpContext.Current.Server.MapPath (".") The current absolute path
The HttpContext.Current.Server.MapPath (HttpContext.Current.Request.ApplicationPath) system
root directory
Sb. Append (String. Format ("Virtual path of the current request: {0}", Server.HTMLEncode
(Request.currentexecutionfilepath)));
Sb. Append (String. Format ("Get the root directory path of the current application: {0}",
Server.HTMLEncode (Request.applicationpath));
Sb. Append (String. Format ("Virtual path of the current request: {0}", Server.HTMLEncode
(Request.filepath)));
Sb. Append (String. Format ("Virtual path of the current request: {0}", Server.HTMLEncode
(Request.path)));
Sb. Append (String. Format ("Gets the physical file system path of the root of the currently executing application:
{0} ", Server.HTMLEncode (Request.physicalapplicationpath)));
Sb. Append (String. Format ("Get the physical file system path corresponding to the requested URL: {0}",
Server.HTMLEncode (Request.physicalapplicationpath));
Virtual path of the current request:/adirectory/sample/responsehtml.aspx
Gets the root directory path of the current application:/adirectory
Virtual path of the current request:/adirectory/sample/responsehtml.aspx
Virtual path of the current request:/adirectory/sample/responsehtml.aspx
Gets the physical file system path of the root directory of the currently executing application: E:\Visual Studio 2005\
Gets the physical file system path that corresponds to the requested URL: E:\Visual Studio 2005\\adirectory\
Sb. Append (String. Format ("Get the full absolute path of the project: {0}",
System.AppDomain.CurrentDomain.BaseDirectory.ToString ()));
This property is available only after an attempt is made to load an assembly into this domain
Sb. Append (String. Format ("Gets the project, which is used by the Assembly resolver to probe dynamically created
Assembly: {0} ", System.AppDomain.CurrentDomain.DynamicDirectory));
Sb. Append (String. Format ("Gets the physical path to the application directory on the disk. : {0} ",
System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath));
Sb. Append (String. Format ("Get the virtual root path of the application: {0}",
System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath));
Sb. Append (String. Format ("Gets the name of the site. : {0} ",
System.Web.Hosting.HostingEnvironment.SiteName));
Sb. Append (String. Format ("Gets the virtual path provider for this application. : {0} ",
System.Web.Hosting.HostingEnvironment.VirtualPathProvider));
Sb. Append (String. Format ("returns the physical file corresponding to the specified virtual path on the WEB server
Path. : {0} ", Server.MapPath (" sss.aspx "));
Transferred from: http://www.cnblogs.com/zhyt1985/archive/2009/10/29/1592245.html
"Reprint" ASP. NET ways to get paths