HttpContextBase.RewritePath Method

Definition

When overridden in a derived class, assigns an internal rewrite path, which lets the request URL differ from the internal path of the resource.

Overloads

RewritePath(String, String, String, Boolean)

When overridden in a derived class, rewrites the URL by using the specified path, path information, query string information, and a value that specifies whether the client file path is set to the rewrite path.

RewritePath(String, String, String)

When overridden in a derived class, rewrites the URL by using the specified path, path information, and query string information.

RewritePath(String, Boolean)

When overridden in a derived class, rewrites the URL by using the specified path and a value that specifies whether the virtual path for server resources is modified.

RewritePath(String)

When overridden in a derived class, rewrites the URL by using the specified path.

RewritePath(String, String, String, Boolean)

When overridden in a derived class, rewrites the URL by using the specified path, path information, query string information, and a value that specifies whether the client file path is set to the rewrite path.

C#
public virtual void RewritePath(string filePath, string pathInfo, string queryString, bool setClientFilePath);

Parameters

filePath
String

The replacement path.

pathInfo
String

Additional path information for a resource.

queryString
String

The request query string.

setClientFilePath
Boolean

true to set the file path used for client resources to the value of the filePath parameter; otherwise, false.

Exceptions

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

RewritePath(String, String, String)

When overridden in a derived class, rewrites the URL by using the specified path, path information, and query string information.

C#
public virtual void RewritePath(string filePath, string pathInfo, string queryString);

Parameters

filePath
String

The replacement path.

pathInfo
String

Additional path information for a resource.

queryString
String

The request query string.

Exceptions

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

RewritePath(String, Boolean)

When overridden in a derived class, rewrites the URL by using the specified path and a value that specifies whether the virtual path for server resources is modified.

C#
public virtual void RewritePath(string path, bool rebaseClientPath);

Parameters

path
String

The replacement path.

rebaseClientPath
Boolean

true to reset the virtual path; false to keep the virtual path unchanged.

Exceptions

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

RewritePath(String)

When overridden in a derived class, rewrites the URL by using the specified path.

C#
public virtual void RewritePath(string path);

Parameters

path
String

The replacement path.

Exceptions

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