The
MappathMethod maps the specified relative or virtual path to the corresponding physical directory on the server.
Parameters (msdn: MS-help: // Ms. msdnqtr.2003feb. 2052/iisref/htm/ref_vbom_seromatrix .htm)
Usage:
1. The location of the server. mappath ("/") application root directory is c: \ Inetpub \ wwwroot \
2. server. mappath ("./") indicates the current directory of the page
Note: It is equivalent to the physical file path on the page where server. mappath ("") is returned.
3. server. mappath ("../") indicates the directory at the upper level.
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, such as: C: \ Inetpub \ wwwroot \ example \
Note: It is equivalent to server. mappath ("~ ").
I don't know if it is correct. I'm studying ......
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"
Example 1: modifying the attribute value of a node of Web. config public void write ()
{
String key1 = This. textbox1.text;
Dataset DS = new dataset ();
DS. readxml (server. mappath ("") + "/Web. config ");
// Not tables [0]
DS. Tables [1]. Rows [0] [1] = key1;
DS. acceptchanges ();
DS. writexml (server. mappath ("") + "/Web. config ");
DS. Dispose ();
}
If the first character of path is "/" or "\", the server. mappath will interpret it as the path starting from the root directory, otherwise server. mappath will interpret it as the path starting from the current directory