Redirect script for .NET

This code can be used to redirect extra domains to a subfolder using .NET code. Remeber to use all caps for the domain name.


<%@ Page Language="C#" %>

&ltscript runat="server">



protected void Page_Load(object sender, EventArgs e)

{

string sname = Request.ServerVariables["SERVER_NAME"].ToString().ToUpper();



if (sname.Contains("DOMAINNAME"))

Response.Redirect("/Foldername");

else

Response.Redirect("default.aspx");

}

</script>



&lthtml>

&ltbody>

</body>

</html>

Add Feedback