HttpContext.RewritePath Method (String, String, String, Boolean)
Rewrites the URL using the given virtual path, path information, query string information, and a Boolean value that specifies whether the client file path is set to the rewrite path.
Assembly: System.Web (in System.Web.dll)
Public Sub RewritePath ( filePath As String, pathInfo As String, queryString As String, setClientFilePath As Boolean )
The virtual path to the resource that services the request.
Additional path information to use for the URL redirect. For more information, see PathInfo.
The request query string to use for the URL redirect.
true to set the file path used for client resources to the value of the filePath parameter; otherwise false.
The filePath parameter does not include the content of the pathInfo parameter. For the URL http://www.microsoft.com/virdir/page.html/tail, the filePath parameter is http://www.microsoft.com/virdir/page.html, and the pathInfo parameter is tail.
To ensure that the virtual path that is used to construct paths to resources is not modified, set the setClientFilePath parameter to false. A common scenario in which you might want to set setClientFilePath to false is when you need to rewrite the URL, and you are using themes and redirecting the URL to a resource located in a different folder than the requested resource.
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.
Available since 2.0