HttpResponse.Redirect Method (String, Boolean)
Assembly: System.Web (in system.web.dll)
An absolute URL (for example, http://www.contoso.com/default.aspx) or a relative URL (for example, default.aspx) can be specified for the target location but some browsers may reject a relative URL.
Redirect calls End which raises a ThreadAbortException exception upon completion.
Note: |
|---|
| For mobile pages only, if your application relies on cookieless sessions, or might receive requests from mobile devices that require cookieless sessions, using a tilde ("~") in a path can result in inadvertently creating a new session and potentially losing session data. To set a property on a mobile control with a path such as "~/path", resolve the path using ResolveUrl "~/path" before assigning it to the property. |
The following code example uses the IsClientConnected property to check whether the client requesting the page remains connected to the server. If IsClientConnected is true, the code calls the Redirect method, and the client will view another page. If IsClientConnected is false, the code calls the End method and all page processing is terminated.
Note: