Export (0) Print
Expand All

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.

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

public void RewritePath (
	string filePath,
	string pathInfo,
	string queryString,
	bool setClientFilePath
)
public void RewritePath (
	String filePath, 
	String pathInfo, 
	String queryString, 
	boolean setClientFilePath
)
public function RewritePath (
	filePath : String, 
	pathInfo : String, 
	queryString : String, 
	setClientFilePath : boolean
)
Not applicable.

Parameters

filePath

The virtual path to the resource that services the request.

pathInfo

Additional path information to use for the URL redirect.

queryString

The request query string to use for the URL redirect.

setClientFilePath

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

Exception typeCondition

ArgumentNullException

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

HttpException

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

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.

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

ADD
Show:
© 2014 Microsoft