asp.net.ph

Server.MapPath Method

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;

Parameters

path
The virtual path on the Web server.

Return Value

The physical file path that corresponds to path.

Exceptions


Exception Type Condition
HttpException Occurs when the Server object is not available.

Remarks

If path is NULL, MapPath returns the full physical path to the directory containing the current application.

Example

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" );
See Also

HttpServerUtility Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph