Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how do i get the servername is global.asa, request.ServerVariables(SERVER_NAME) doesn't work

303 views
Skip to first unread message

Peter Jansen

unread,
Feb 23, 2001, 10:38:02 AM2/23/01
to
Hi,
We need to get the server name (name of the computer) in global.asa,
Request.ServerVariables("SERVER_NAME") doesn't seem to work, I suppose
because global.asa isn't directlty called by a client that returns HTTP
header variables - or am I doing something wrong?

Any tricks of the trade someone might devulge?

Thanks
Peter Jansen


Phill W.

unread,
Feb 23, 2001, 10:37:05 AM2/23/01
to
Peter,

OK, I'll ask the question.
Why do you [feel you] need it in Global.Asa?

Regards,
Phill W.

Peter Jansen <pja...@konnectsoft.com> wrote in article
<5pvl6.4969$5U3.29801@NewsReader>...

Bob Lehmann

unread,
Feb 23, 2001, 12:42:17 PM2/23/01
to
I use this no problem -

If Request.ServerVariables("Server_Name") = "machine_name" Then
'Do Stuff
End If

--
Bob Lehmann

Active Internet Solutions
Database Solutions for Web Developers
www.activeinet.com

Peter Jansen <pja...@konnectsoft.com> wrote in message
news:5pvl6.4969$5U3.29801@NewsReader...

Bob Lehmann

unread,
Feb 23, 2001, 12:46:34 PM2/23/01
to
I use it to determine whether I am on my developepment server or my client's
production server. My main client uses system DSNs and I don't want them on
my server so I check the server and then use a dsn in production and a
DSN-less connection on my machine.

--
Bob Lehmann

Active Internet Solutions
Database Solutions for Web Developers
www.activeinet.com

Phill W. <P.A....@open.ac.uk> wrote in message
news:01c09dae$8f01bce0$0fa96c89@pcms248...

Peter Jansen

unread,
Feb 23, 2001, 1:18:38 PM2/23/01
to
Is this inside the Session_OnStart event?
I tried in the Application_OnStart, which didn't seem to work, and then
noticed that the doc said "Referencing the Session, Request, or Response
objects in the Application_OnStart event script causes an error. ", maybe I
just had a syntax error or something but it seemed sort of logical that it
wouldn't work at the application start...

"Bob Lehmann" <nospam...@my.com> wrote in message
news:eY7#v#bnAHA.1224@tkmsftngp04...

Rod Nitz

unread,
Feb 23, 2001, 1:14:41 PM2/23/01
to
Peter:

I had no problem storing the SERVER_NAME variable in the global.asa. Heres
what it looks like:

session("client")=Request.ServerVariables("SERVER_NAME")

I put this in the session_onstart event and of course you don't have to use
"client" as the name.

Make sure global.asa exists within your application.

Rod


Peter Jansen <pja...@konnectsoft.com> wrote in message
news:5pvl6.4969$5U3.29801@NewsReader...

Bob Lehmann

unread,
Feb 23, 2001, 1:43:10 PM2/23/01
to
Yes, it's in Session_OnStart.

--
Bob Lehmann

Active Internet Solutions
Database Solutions for Web Developers
www.activeinet.com

Peter Jansen <pja...@konnectsoft.com> wrote in message

news:FLxl6.5521$5U3.31167@NewsReader...

Jeff Dillon

unread,
Feb 23, 2001, 6:40:33 PM2/23/01
to
What do you mean by "doesn't seem to work". How do you determine this?

Perhaps your global.asa isn't firing at all, because the directory isn't
marked as a virtual directory or IIS application.

Jeff

"Peter Jansen" <pja...@konnectsoft.com> wrote in message
news:5pvl6.4969$5U3.29801@NewsReader...

Peter Jansen

unread,
Feb 25, 2001, 10:34:48 AM2/25/01
to
The issue was that I was trying to do this in Application_Onstart (becuase
it is not something that needs to be checked for each session in our app)
and the request object is not accessable there. I actually found a way to
do this on application start was to use WSH and look at the environment
variables.

"Peter Jansen" <pja...@konnectsoft.com> wrote in message
news:5pvl6.4969$5U3.29801@NewsReader...

0 new messages