Is there a way using ASP.NET that I can 302 (temporary) redirect all pages on the website to the homepage (obviously not redirecting the homepage)?
Add this in your Global.asax file:
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (Request.Url.LocalPath != "/Home.aspx")
HttpContext.Current.Response.Redirect("Home.aspx");
}
From the HttpResponse.Redirect Method (String) article:
ASP.NET performs the redirection by returning a 302 HTTP status code.
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