System.Web Namespace HttpServerUtility Class
Returns the physical file path that corresponds to the specified virtual path on the Web server.
[ VB ]
Public Function MapPath ( _
ByVal path As String _
) As String
[ C# ]
public string MapPath (
string path
);
[ C++ ]
public: String* MapPath (
String* path
);
[ JScript ]
public function MapPath (
path : String
) : String;
- path
- The virtual path on the Web server.
The physical file path that corresponds to path.
Exception Type |
Condition |
HttpException |
Occurs when the Server object is not available. |
If path is NULL, MapPath returns the full physical path to the directory containing the current application.
The following example returns the physical path of the virtual directory that contains the specified Web site.
[ VB ]
Dim FilePath As String
FilePath = Server.MapPath ( "MyWebSite" )
[ C# ]
String FilePath;
FilePath = Server.MapPath ( "MyWebSite" );
HttpServerUtility Members