Namespace: system. Web. httpcontext. Current. server. mappath ();
Usage:
1. server. mappath ("/") // ApplicationProgramThe location of the root directory is c: \ Inetpub \ wwwroot \
2. server. mappath ("./") // indicates the current directory of the page
Note:Equivalent to server. mappath ("") // returns the physical file path of the page where server. mappath ("") is located.
3. server. mappath ("../") // indicates the upper-level directory
4. server. mappath ("~ /") // Indicates the directory of the current application. If it is the root directory, it is the root directory. If it is a virtual directory, it is the location of the virtual directory, for example: C: \ Inetpub \ wwwroot \ example \
Note:Equivalent to server. mappath ("~ ").
In addition, the following statements are equivalent:
String filename = server. mappath ("./") + @ "\ WEB. config ";
String filename = server. mappath ("./") + "/Web. config ";
String filename = server. mappath ("") + @ "\ WEB. config ";