467,223 Members | 1,400 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,223 developers. It's quick & easy.

Retrieve Server Name

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

May 3 '06 #1
  • viewed: 1999
Share:
1 Reply

"Lyners" <Ly****@discussions.microsoft.com> wrote in message
news:FD**********************************@microsof t.com...
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
May 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by jandt | last post: by
3 posts views Thread by serge calderara | last post: by
1 post views Thread by Eugfene | last post: by
reply views Thread by Adict | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.