Select Page

You can redirect an ASP.NET page using one of three methods. The first method is through metatag redirection. If that fails, then it will try to redirect with JavaScript. If that fails, a URL will be displayed that the user can click on to redirect the page.
An HTML 5 only version of this redirect page can be found in the post Redirecting Pages in HTML 5.
— ASP.NET code below —
<%@ Page Language=”C#” %>
<!DOCTYPE html>
<script runat=”server”>
</script>
<html>
<head runat=”server”>
<title>Page Title</title>
<meta http-equiv=”Refresh” content=”0; url=http://www.website.com”>
<!– If the meta tag doesn’t work, try JavaScript to redirect. –>
<script type=”text/javascript”>
window.location.href = “http://www.website.com”
</script>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<!– If JavaScript doesn’t work, give a link to click on to redirect. –>
<p>If you are not redirected automatically, click <a href=’http://www.website.com’>here</a>.</p>
</div>
</form>
</body>
</html>

Print Friendly, PDF & Email
Translate ยป