HttpRequestWrapper.MapPath Method

Definition

Maps the virtual path in the requested URL to a physical path on the server.

Overloads

MapPath(String)

Maps the specified virtual path to a physical path on the server.

MapPath(String, String, Boolean)

Maps the specified virtual path to a physical path on the server.

MapPath(String)

Maps the specified virtual path to a physical path on the server.

C#
public override string MapPath(string virtualPath);

Parameters

virtualPath
String

The virtual path (absolute or relative) to map to a physical path.

Returns

The physical path on the server that is specified by virtualPath.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

MapPath(String, String, Boolean)

Maps the specified virtual path to a physical path on the server.

C#
public override string MapPath(string virtualPath, string baseVirtualDir, bool allowCrossAppMapping);

Parameters

virtualPath
String

The virtual path (absolute or relative) to map to a physical path.

baseVirtualDir
String

The virtual base directory path that is used for relative resolution.

allowCrossAppMapping
Boolean

true to indicate that virtualPath can belong to another application; otherwise, false.

Returns

The physical path on the server.

Exceptions

allowCrossAppMapping is false and virtualPath belongs to another application.

-or-

No HttpContext object is defined for the request.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1