Retrieve Server Name

G

Guest

What I need - To retrieve the server name that the ASP application is running
on.

Why - Our current intranet is on a network where we have users that are on a
domain and some that are not. Using I.P. addresses all the users can access
the ASP pages. Using I.P. addresses, no one can use our .net pages because
the header that is passed back from the server has extra security that
require the end users to "log-in" to the server. This is caused by the .net
server thinking that the request is coming from outside of the domain because
an I.P. address is requesting information, thus it sends back to the client
the security header. When we change the I.P. addresses to the server name,
all the people on the domain can access our .net pages and ASP pages. The
personnel outside of the domain cannot access the .net pages, but can access
the ASP pages. So what we have done is made two default pages (default.asp
and default.aspx). All users are directed to the default.asp page, on this
page is a link for users to access the default.aspx pages for users that are
members of the domain. The link for the default.aspx page is hard-coded with
the server name. What we want to do is dynamically fill in the server name
for what ever server this is running on.

In short we have tried this, it works in our development environment because
the programmer has admin authority, but doesn't work on the production server.

<%
Set Loc = createobject("WBEMScripting.SWBEMLocator")
Set nms = Loc.ConnectServer()
WQL = "SELECT CSName FROM Win32_OperatingSystem"
Set cs = nms.ExecQuery(WQL, "WQL", 48)
For Each pc In cs
%>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><A
href="http://<%Response.Write pc.CSName%>/intranet/default.aspx"><b>DOMAIN
LINK</b> <--</p>
<p></p>
<%
Next
set cs = nothing: set nms = nothing: set loc = nothing
%>

We are getting this error;
SWbemLocator error '80041003'

Access denied

What is the correct way for us to retrieve the server name so that we can
dynamically fill in the hyperlink?

Thank you,
Lyners
 
T

Tony B

Lyners said:
What I need - To retrieve the server name that the ASP application is
running
on.

Why - Our current intranet is on a network where we have users that are on
a
domain and some that are not. Using I.P. addresses all the users can
access
the ASP pages. Using I.P. addresses, no one can use our .net pages because
the header that is passed back from the server has extra security that
require the end users to "log-in" to the server. This is caused by the
.net
server thinking that the request is coming from outside of the domain
because
an I.P. address is requesting information, thus it sends back to the
client
the security header. When we change the I.P. addresses to the server name,
all the people on the domain can access our .net pages and ASP pages. The
personnel outside of the domain cannot access the .net pages, but can
access
the ASP pages. So what we have done is made two default pages (default.asp
and default.aspx). All users are directed to the default.asp page, on this
page is a link for users to access the default.aspx pages for users that
are
members of the domain. The link for the default.aspx page is hard-coded
with
the server name. What we want to do is dynamically fill in the server name
for what ever server this is running on.

In short we have tried this, it works in our development environment
because
the programmer has admin authority, but doesn't work on the production
server.

<%
Set Loc = createobject("WBEMScripting.SWBEMLocator")
Set nms = Loc.ConnectServer()
WQL = "SELECT CSName FROM Win32_OperatingSystem"
Set cs = nms.ExecQuery(WQL, "WQL", 48)
For Each pc In cs
%>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><A
href="http://<%Response.Write pc.CSName%>/intranet/default.aspx"><b>DOMAIN
LINK</b> <--</p>
<p></p>
<%
Next
set cs = nothing: set nms = nothing: set loc = nothing
%>

We are getting this error;
SWbemLocator error '80041003'

Access denied

What is the correct way for us to retrieve the server name so that we can
dynamically fill in the hyperlink?

Thank you,
Lyners

Request.ServerVariables("SERVER_NAME") will give the address of the server.

for example if your page is at http://www.example.com/default.asp then

Request.ServerVariables("SERVER_NAME") would return www.example.com

Is this what you were looking for?

Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top