473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

asp.net/c# redirection based on domain

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?
Nov 15 '05 #1
1 1559
For starters, you are checking the results of ToUpper with lowercase
literals.

-Rob Teixeira [MVP]

"hunter" <fa***********@cox.net> wrote in message
news:RbECb.6128$J77.5123@fed1read07...
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?

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: astpaul | last post by:
Hi, I want to resize the main window through Javascript using the self.resizeTo() function. Nevertheless i've ot a pb: I have a domain (http://www.re-crear.org). This domain is redirected...
2
by: Paul | last post by:
I am setting up 4 sites for a small business complex. They wanted to save money on hosting so asked to have all the sites under one hosting plan, but with independent domain names. I thought that...
7
by: Steph | last post by:
Bonjour, Je souhaite lancer une redirection vers un fichier php via SRC= dans une condition if (voir ci-dessous en bas du script) mais la redirection ne fonctionne pas. Par contre la condition...
3
by: Bishoy George | last post by:
Hi, I want an asp.net code for redirection: I have multiple domains pointing to one page , let's call it page0.aspx I want to put a code in page0.aspx so when domain1 opens page0.aspx it...
8
by: Luciano A. Ferrer | last post by:
Hi! I was following the http://www.seomoz.org/articles/301-redirects.php article, trying to do that with one of my test sites I added this to the .htaccess file: RewriteEngine On RewriteCond...
2
by: fReDiNi | last post by:
Hi, I have an strange problem with session variables. I have a site hosted in a local server. I have physic access to this server and its configuration.(apache, php,files...). I have external...
13
by: Massimo Fabbri | last post by:
Maybe it's a little OT, but I'll give it try anyway.... I was asked to maintain and further develop an already existing small company's web site. I know the golden rule of "eternal" URIs, but...
33
by: rvj | last post by:
if you redirect on an IIS , must the client url address bar always be updated with the new address. what options are? Q1 if a user requests http://old.com , is there a method of ASP...
3
by: Genius79 | last post by:
Hi I'm trying to do an ASP authentication using Ldap and would like to have the users directed to pages based on the Organizational Unit. My ASP knowledge is pretty basic but would really like to get...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.