HttpContext.RewritePath Method (String, Boolean)

Rewrites the URL using the given path and a Boolean value that specifies whether the virtual path for server resources is modified.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

public void RewritePath (
	string path,
	bool rebaseClientPath
public void RewritePath (
	String path, 
	boolean rebaseClientPath
public function RewritePath (
	path : String, 
	rebaseClientPath : boolean
Not applicable.



The internal rewrite path.


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

Exception typeCondition


The path parameter is a null reference (Nothing in Visual Basic).


The path parameter is not in the current application's root directory.

The HttpContext.RewritePath(String,Boolean) method is called by the HttpContext.RewritePath(String) method with the rebaseClientPath parameter set to true. To ensure that the virtual path that is used to construct paths to resources is not modified, set the rebaseClientPath parameter to false. A common scenario in which you might want to set rebaseClientPath 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.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions