How can I redirect user based on host in aspx page? For example, I want redirect user to localhost99.com if url is host22.com and redirect to host22.com if url is localhost99.com
I tried out something like this:
protected void Page_Load(object sender, EventArgs e)
{
if (Request.ServerVariables["SCRIPT_NAME"] + "?" + Request.ServerVariables["QUERY_STRING"] != "host22.com/default.aspx")
{
Response.Redirect("http://localhost99.com/");
}
}
Please help. Thanks.