asp.net/c# redirection based on domain

  • Thread starter Thread starter hunter
  • Start date Start date
H

hunter

Hey guys, new to the forums.

I have a quick question, let me explain.

I have 2 domains pointing to one server, and I'd like them to each bounce to
a different folder on the server. I know you can do this with
Response.Redirect, but what would the code be? I've tried this:

private void Page_Load(object sender, System.EventArgs e)
{


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

if (ClientURL.IndexOf("evasionaz") > -1)
{

Response.Redirect("/evasion/");

}
else if (ClientURL.IndexOf("entropyx") > -1)
{

Response.Redirect("/entropy");

}
}

but that didn't work, anyone know how to work this out with C#/asp.net?
 
For starters, you are checking the results of ToUpper with lowercase
literals.

-Rob Teixeira [MVP]
 
Back
Top