/ Published in: ASP
URL: asp.net-redirect
Expand |
Embed | Plain Text
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> //Url to redirect this page to Uri urlRedirect = new Uri("http://design.leerjohnson.com"); private void Page_Load(object sender, System.EventArgs e) { //Provide link when not redirected Page.Title += " to " + urlRedirect.ToString(); aRedirectLink.InnerText = urlRedirect.AbsoluteUri; aRedirectLink.HRef = urlRedirect.AbsoluteUri; //Set Response Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", urlRedirect.AbsoluteUri); } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>This page has moved</title> </head> <body> <h1>This page has moved to <a id="aRedirectLink" runat="server" /></h1> </body> </html>
You need to login to post a comment.
