Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 08:45 AM
Roger Withnell
Guest
 
Posts: n/a
Default Identifying the web site address of the current page

I have several web sites running the same set of pages and
all accessing the same common database tables. A field in
all the records contains the web site address of the web
site to which each record pertains, for example, this
field in some records may contain www.upperbridge.co.uk.
When a web site page accesses a database table, it needs
to select the records that contain its web site address.
How do I identify which web site this page is in? For
example, if a page is part of web site
www.upperbridge.co.uk, how does the page get hold of this
web site address so it can use it to select the correct
records in the common database tables?

  #2  
Old July 19th, 2005, 08:45 AM
Bob Barrows
Guest
 
Posts: n/a
Default Re: Identifying the web site address of the current page

Roger Withnell wrote:[color=blue]
> I have several web sites running the same set of pages and
> all accessing the same common database tables. A field in
> all the records contains the web site address of the web
> site to which each record pertains, for example, this
> field in some records may contain www.upperbridge.co.uk.
> When a web site page accesses a database table, it needs
> to select the records that contain its web site address.
> How do I identify which web site this page is in? For
> example, if a page is part of web site
> www.upperbridge.co.uk, how does the page get hold of this
> web site address so it can use it to select the correct
> records in the common database tables?[/color]

A servervariable should contain this info. I don't feel like going to look
up which one at the moment, but you can generate all the servervariables
like this:

for each item in request.servervariables
response.write item & ": "
response.write request.servervariables(item) & "<BR>"
next

HTH,
Bob Barrows


  #3  
Old July 19th, 2005, 08:45 AM
Mark Reichard
Guest
 
Posts: n/a
Default Re: Identifying the web site address of the current page

Roger,

Use request.servervariables("SERVER_NAME"). That's exactly what that
function is for. Even for multiple sites on the same server, it will
return the site URL.

Thanks,
Mark

Simple Content Management -- http://www.synapsecm.com
Multilingual Web Development -- http://www.idataconsultingservices.com
  #4  
Old July 19th, 2005, 08:45 AM
Matt Simner
Guest
 
Posts: n/a
Default Re: Identifying the web site address of the current page

Hi Roger,

If I understand correctly - you basically want to know the host name
from each page.

try using ...

Request.ServerVariables("SERVER_NAME")

This should contain the 'host name' for that page e.g.
www.upperbridge.co.uk

Look at this MSDN article for all of the other ServerVariables you can
access...

http://msdn.microsoft.com/library/de...om_reqocsv.asp

HTH,

Matt Simner


"Roger Withnell" <roger@upperbridge.co.uk> wrote in message news:<2025201c38a87$dc8270e0$a601280a@phx.gbl>...[color=blue]
> I have several web sites running the same set of pages and
> all accessing the same common database tables. A field in
> all the records contains the web site address of the web
> site to which each record pertains, for example, this
> field in some records may contain www.upperbridge.co.uk.
> When a web site page accesses a database table, it needs
> to select the records that contain its web site address.
> How do I identify which web site this page is in? For
> example, if a page is part of web site
> www.upperbridge.co.uk, how does the page get hold of this
> web site address so it can use it to select the correct
> records in the common database tables?[/color]
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles