HttpServerUtility.MapPath Method
Assembly: System.Web (in system.web.dll)
| Exception type | Condition |
|---|---|
| The current HttpContext is a null reference (Nothing in Visual Basic). |
If path is a null reference (Nothing in Visual Basic), then the MapPath method returns the full physical path to the directory containing the current application.
Caution |
|---|
| The MapPath method potentially contains sensitive information about the hosting environment. The return value should not be displayed to users. |
The following code example returns the physical path of the virtual directory that contains the specified Web site. To read MapPath in a code-behind module, use HttpContext.Current.Server.MapPath.
String filePath;
filePath = get_Server().MapPath("/MyWebSite");
var filePath : String = Server.MapPath("/MyWebSite")
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Caution