Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 13th, 2004, 02:41 AM
Friend of Wrox
Points: 1,288, Level: 14
Points: 1,288, Level: 14 Points: 1,288, Level: 14 Points: 1,288, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2004
Location: Stockholm, Sweden
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default Multiple domains on a single IP

Dears here is some code which allow multiple domains on a single IP address. But I can't understand this code. If any one of you understand this then please tel. I will be great full to you

<%
 host = lcase(request.servervariables("HTTP_HOST"))
 SELECT CASE host
     CASE "www.chatventure.com"
         response.redirect "http://212.187.35.210/chatventure/main.htm"
     CASE "www.cewebserver.com"
         response.redirect "http://212.187.35.210/cewebserver/main.htm"
     CASE ELSE
         response.redirect "http://www.codeproject.com"
 END SELECT
 %>

http://www.codeproject.com/asp/multidomain.asp


Numan
--------------------------------------------------
Love is the most precious thing of this world. So find it and grab it!
__________________
(*_*)

Numan
--------------------------------------------------
It is not important what you get But important is&nbsp;&nbsp;how you got it
Reply With Quote
  #2 (permalink)  
Old September 13th, 2004, 03:29 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Request.ServerVariables is a collection which gives many information about the hosting server, its operating system and the current page being served.

There are many members in it. Some of them are :

1) HTTP_REFERRER - the page which called the current page

2) SERVER_NAME - the virtual directory / host name / DNS alias / IP address of the page being served. If you are using this in a page http://www.yoursite.com/users/welcome.asp, Request.ServerVariables("SERVER_NAME") will give www.yoursite.com

3) SCRIPT_NAME - the path of current file in relation to host name. If you are using this in a page http://www.yoursite.com/users/welcome.asp, Request.ServerVariables("SCRIPT_NAME") will give /users/welcome.asp

You can get a list of them from

http://www.codeproject.com/asp/reque..._variables.asp


Request.ServerVariables("HTTP_HOST") will give the name of the host on the server. i.e. www.yoursite.com in the abobe example.

I hope, with this knowledge, the rest of the code you can understand.
Reply With Quote
  #3 (permalink)  
Old September 13th, 2004, 07:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Numan,

request.servervariables("HTTP_HOST") - This holds the domain/Host value of the URL given in your browser.

When you say, http://www.somedomain.com/somepath/somepage.ext

HTTP_HOST server variable would hold www.somedomain.com as its value. The code you posted, does a check for Domain and based on that it redirects the user to the corresponding page of the same IP.

Hope that explains.
Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #4 (permalink)  
Old September 15th, 2004, 04:44 AM
Friend of Wrox
Points: 1,288, Level: 14
Points: 1,288, Level: 14 Points: 1,288, Level: 14 Points: 1,288, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2004
Location: Stockholm, Sweden
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

But please explain this that how can I change the address as the user enters it only once and when he access that page then how can he change its address ? And one thing more that if user enters any other address then how he reach this page to change its address?




Numan
--------------------------------------------------
Love is the most precious thing of this world. So find it and grab it!
Reply With Quote
  #5 (permalink)  
Old September 15th, 2004, 06:52 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

You can include the above piece of script on the top of every page. Or is there anything I am missing about your requirement ?
Reply With Quote
  #6 (permalink)  
Old September 15th, 2004, 09:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Numan,

As madhu said, you may want to add that code snip to the top of every page. But, not sure what you are referring to in your second question.

Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #7 (permalink)  
Old September 16th, 2004, 12:26 AM
Friend of Wrox
Points: 1,288, Level: 14
Points: 1,288, Level: 14 Points: 1,288, Level: 14 Points: 1,288, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2004
Location: Stockholm, Sweden
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Dear this code is redirect the user when user access this page. For example

This page is at
www.chatventure.com

When user write www.chatventure.com in its browser's address then it shows this page. else user write any other address in its address bar then how this page is effective ?

Numan
--------------------------------------------------
Love is the most precious thing of this world. So find it and grab it!
Reply With Quote
  #8 (permalink)  
Old September 16th, 2004, 12:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

As per this code, if the user tries to browse "www.chatventure.com", it is redirected to "http://212.187.35.210/chatventure/main.htm"

If he tries "www.cewebserver.com" then redirected to "http://212.187.35.210/cewebserver/main.htm"

Else anything else is tried it goes to "http://www.codeproject.com". I assume that the webserver should have just this file say "default.asp" in its root, and no other files, only then this would be effective if someone hits this webserver from his/her browser. Else it would go to any URL that the user tries.

Hope that explains.
Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #9 (permalink)  
Old September 16th, 2004, 04:22 AM
Friend of Wrox
Points: 1,288, Level: 14
Points: 1,288, Level: 14 Points: 1,288, Level: 14 Points: 1,288, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2004
Location: Stockholm, Sweden
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Quote:
quote:Originally posted by happygv
 I assume that the webserver should have just this file say "default.asp" in its root, and no other files, only then this would be effective if someone hits this webserver from his/her browser. Else it would go to any URL that the user tries.


But please explain this that when user enter any other url then how browser open this page to redirect the user to some page ?


Numan
--------------------------------------------------
Love is the most precious thing of this world. So find it and grab it!
Reply With Quote
  #10 (permalink)  
Old September 16th, 2004, 04:36 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Could you please explain your problem with some example ?

Something like

When user types this into location bar, it should do this etc. etc.

What you type at the location bar will be automatically changed once the redirection happens. Do you want to prevent this ?

i.e. when user types www.chatventure.com at location bar, it will be changed to http://212.187.35.210/chatventure/main.htm automatically. Do you want to prevent this ?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple views of single table jatatman ASP.NET 3.5 Basics 1 June 2nd, 2008 01:34 AM
Representing multiple items with a single value? Donny Bahama Classic ASP Professional 1 January 16th, 2006 09:32 PM
multiple selects -single where clause collie SQL Server 2000 3 January 21st, 2005 01:27 AM
Single or Multiple application. Gibs_poovath General .NET 7 May 25th, 2004 07:54 AM
single login for different domains dhaywirex Classic ASP Basics 6 April 29th, 2004 01:53 AM



All times are GMT -4. The time now is 10:41 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.