Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Server Name

Status
Not open for further replies.

sipps

Technical User
Feb 9, 2003
133
GB
Hey all,

I would like to be able to get the name of the server that my ASP pages are on. I need some sort of function to tell me what URL the user has used to access the site. This is because some users access it through an IP address and some through a domain name.

The returned server name/IP address will be used when sending HTML emails from the server. There are links to images, and depending on what URL they accessed the site with, the link to the images needs to change in the email!

Anyway, if anyone knows of a function that could return:

" or " for example, that would be great!

Cheers

sipps
 
yes there is a request.ServerVariable() object, there are many parameters for it, one of them will be useful to u (sorry forgot which one), it will return the url of the page that called this page.

Known is handfull, Unknown is worldfull
 
As vbkris recommended, you can get the info from the server variables object. There are loads of these, and you should easily be able to find documentation on them. Below are some you will probably find most useful for your task. If you response.write each of them you will see the values they return.

request.servervariables("itemname")

with the following items:

REMOTE_ADDR
REMOTE_HOST
SERVER_NAME
SERVER_PORT
URL
HTTP_HOST

e.g. request.servervariables("http_host")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top