473,513 Members | 2,469 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detecting the requested domain name??

Hi,
I have two domain names pointing to the same webspace, but i want them to be
directed to seperate directories on the server:
www.web1.com -> dir "Web1"
www.web2.com -> dir"Web2"

The company hosting my website dont allow more than one domain to pointto
seperate directories (to prevent reselling), but suggested that some code
could be written to direct the browser to the appropriate directory
depending on which url was used.

Any ideas on how I can determine which URL the user wants so that i can then
redirect them to the appropriate homepage??

Thanks

Andrew
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.770 / Virus Database: 517 - Release Date: 27/09/2004
Nov 18 '05 #1
3 1642
"andrew sargent" <as@nospam.com> wrote in
news:V7********************@fe2.news.blueyonder.co .uk:
I have two domain names pointing to the same webspace, but i want them
to be directed to seperate directories on the server:
www.web1.com -> dir "Web1"
www.web2.com -> dir"Web2"


Something like this in your global.asax Session_OnStart should do the
trick.

Dim sname as string = Request.ServerVariables("SERVER_NAME")
sname = ucase(sname)
if InStr(sname,"DOMAIN1") <> 0 then
response.redirect "subdirectory to go to"
elseif InStr(sname,"DOMAIN2") <> 0 then
response.redirect "2nd subdirectory to go to"
elseif.......
end if
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #2
Thanks for your help, but that doesn't seem to do the trick.
looks like i will just have to get a seperate hosting plan for the second
site.

Andrew
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@140.99.99.130.. .
"andrew sargent" <as@nospam.com> wrote in
news:V7********************@fe2.news.blueyonder.co .uk:
I have two domain names pointing to the same webspace, but i want them
to be directed to seperate directories on the server:
www.web1.com -> dir "Web1"
www.web2.com -> dir"Web2"


Something like this in your global.asax Session_OnStart should do the
trick.

Dim sname as string = Request.ServerVariables("SERVER_NAME")
sname = ucase(sname)
if InStr(sname,"DOMAIN1") <> 0 then
response.redirect "subdirectory to go to"
elseif InStr(sname,"DOMAIN2") <> 0 then
response.redirect "2nd subdirectory to go to"
elseif.......
end if
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.770 / Virus Database: 517 - Release Date: 27/09/2004
Nov 18 '05 #3
"andrew sargent" <as@nospam.com> wrote in message
news:cR*********************@fe2.news.blueyonder.c o.uk...
Thanks for your help, but that doesn't seem to do the trick.
looks like i will just have to get a seperate hosting plan for the second
site.


I think you need to do this client-side in your default.aspx file...

<script language="Javascript">
var URL;
URL = window.location;

if (URL == "http://www.redproductioncompany.co.uk/" || URL ==
"http://www.redproductioncompany.co.uk")
{
window.location.href=("http://www.redproductioncompany.com/home1.asp");
}
else if (URL == http://www.redproductioncompany.com/" || URL ==
"http://www.redproductioncompany.com")
{
window.location.href=("http://www.redproductioncompany.com/home1.asp");
}

</script>
Nov 18 '05 #4

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

Similar topics

4
23872
by: Charles | last post by:
Hi, I have a site that has several domains pointing to its DNS. I would like to implement a script that will grab the domain name visitors typed in, and display it on the page. Is there a way to...
2
5811
by: Stuart | last post by:
Hi all, I am trying to send a fax programatically using the FAXCOMEx.DLL with .Net (C# and COM Interop). I have built a little class to encapsulate the logic for sending the fax - not much to...
1
1742
by: Luthor | last post by:
Hi, Say I'm on the site www.xyz.com and on a certain page if the user leaves the domain xyz.com, I have a popup cme up w/ stuff. I don't need to know what the new domain is, I just want to know...
1
8918
by: vijay | last post by:
Hello I am learnign Dot NEt I have implemted 1. remote object 2.Listener 3.Client Listener started and listening to requests Client started and able to nstantiate remote object But when a...
10
8178
by: Clint | last post by:
Hey all - I'm having a really confusing problem concerning a web service. Right now, I have an application that needs to call a web service that does nothing but return "true" (this will...
2
3022
by: Sam-Kiwi | last post by:
I've spent the last 6 months developing a pay-per-download website using ASP.NET Users purchase documents and then download them. The intention is that users are only charged for documents...
1
4323
by: Roshan | last post by:
Hi, I wanted a reliable way of detecting if a given NTAccount object represents a user account or group account. I was using SecurityIdentifier.IsAccountSid() method but this doesn't work as I...
3
30494
by: martin | last post by:
Hello, Could someone here please explain the reason for the error in the subject (the full error below) I dont get this everytime and i've never gotten while debugging. The code (also below)...
15
3985
by: =?Utf-8?B?U2ltb24=?= | last post by:
Hi I am trying to read the html header 'if modified since' by using Request.ServerVariables("HTTP_IF_MODIFIED_SINCE") in classic ASP. But I am unable to get anything from this, this variable is...
0
7158
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5683
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5085
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.