.NET Framework Class Library
HttpContext.RewritePath Method

Assigns an internal rewrite path. RewritePath allows for the URL that is requested to differ from the internal path to the resource. RewritePath is used in cookieless session state.

Overload List

Assigns an internal rewrite path.

[Visual Basic] Overloads Public Sub RewritePath(String)
[C#] public void RewritePath(string);
[C++] public: void RewritePath(String*);
[JScript] public function RewritePath(String);

Assigns an internal rewrite path.

[Visual Basic] Overloads Public Sub RewritePath(String, String, String)
[C#] public void RewritePath(string, string, string);
[C++] public: void RewritePath(String*, String*, String*);
[JScript] public function RewritePath(String, String, String);

Example

[Visual Basic, C#] The following example

[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of RewritePath. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Sub Button_Click(sender as Object, e As EventArgs)
   Response.Write("Data submitted to this page")    
End Sub    

Sub Page_Load( sender as Object, e As EventArgs ) 
   'Create a 'Httpcontext' object using 'Current' property
   Dim myContext As HttpContext =  HttpContext.Current
   
   'Rewrite the internal path            
   myContext.RewritePath("HttpContext_Next.aspx")
End Sub    

[C#] 
void Button_Click(Object sender,EventArgs e)
{      
   Response.Write("Data submitted to this page");    
}
     
void Page_Load(Object sender,EventArgs e) 
{
   //Create a 'Httpcontext' object using 'Current' property
   HttpContext myContext =  HttpContext.Current;
 
   //Rewrite the internal path            
   myContext.RewritePath("HttpContext_Next.aspx");        
}

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

HttpContext Class | HttpContext Members | System.Web Namespace

Page view tracker