On several occasions I have needed to redirect a user from one place to another in ASP.NET. I like to do this with code similar to the following, which doesn’t require code-behind.
<%@ Page Language="C#" AutoEventWireup="true" %><!DOCTYPE html> <script runat="server"> private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","/public/Default.aspx"); } </script> <html> <head runat="server"> <title>Redirecting...</title> </head> <body> </body> </html>