How do I redirect from one ASP.NET page to another ("Webform2.aspx") by means of a button?
Response. Redirect("~"); Using the HttpContext you can get the current request, response etc. However be careful to always check to ensure the current context is not null, especially if you are calling from your business layer classes.
You can use any of the following methods to return a RedirectResult: Redirect – Http Status Code 302 Found (temporarily moved to the URL provided in the location header) RedirectPermanent – Http Status Code 301 Moved Permanently. RedirectPermanentPreserveMethod – Http Status Code 308 Permanent Redirect.
You can redirect from one page to another using Response.Redirect()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With