System.Web.HttpContext.RewritePath Method

Rewrites the URL using the given path.

Syntax

public void RewritePath (string path)

Parameters

path
The internal rewrite path.

Remarks

The HttpContext.RewritePath(string) method redirects a request for a resource to a different path than the one that is indicated by the requested URL. If you have to reset the virtual path so that requests from the client for server resources resolve correctly, use the overload of this method that takes the rebaseClientPath parameter and set the parameter to false.

URL rewriting is useful when you want to restructure the pages in your Web application, and you want to make sure that people who have bookmarked old URLs can still use them after you have moved pages. URL rewriting enables you to transparently forward requests to the new page location.

If you want to enable a site to use URLs that are more user-friendly and are optimized for search engines, a more robust alternative is to use ASP.NET routing. For more information, see ASP.NET Routing.

Requirements

Namespace: System.Web
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0