HttpServerUtility.MapPath Method
.NET Framework 3.0
Returns the physical file path that corresponds to the specified virtual path on the Web server.
Namespace: System.Web
Assembly: System.Web (in system.web.dll)
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 of the directory that contains the current application.
Security Note: |
|---|
| The MapPath method potentially contains sensitive information about the hosting environment. The return value should not be displayed to users. |
The following 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")
Community Additions
ADD
Show:
Security Note: