You are Here:
FAQ
Scripting & Programming
ASP .Net
Article #10
|
Redirecting to a different website or a folder using asp.netThe following example redirects s119712208.websitehome.co.uk to http://1and1.co.uk and usa-test.com to usa-test.com/www/index.htm (redirecting to a different folder)
<script runat="server" Language="c#">
public void Page_Init(Object Src, EventArgs E)
{
switch((Request.ServerVariables["HTTP_HOST"]).Replace("www.",""))
{
case "s119712208.websitehome.co.uk":
Response.Redirect("http://1and1.co.uk");
break;
case "usa-test.com":
Response.Redirect("http://usa-test.com/www/index.htm");
break;
default:
Response.Redirect("http://1and1.co.uk");
break;
}
}
</script>
|
© 2007 1&1 Internet Ltd - About 1&1 Internet