473,396 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
1 2262

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jandt | last post by:
I know that you can retrieve data from a form using Request.Form("name"), but how do you retrieve a file?
3
by: serge calderara | last post by:
Dear all, I have a tool which is able to receive any kind of data from a remote system. For that I need to get the ipadress of the remote system. If the system is not connected to a DHCP...
1
by: Eugfene | last post by:
I have the following function in a html file: function selectEdit(fileID, processCode, processID, fileName,fileDesc) { document.forms.recordID.value = fileID; document.forms.processor.value =...
5
by: Roy Gourgi | last post by:
Hi, I am used to working in Visual FoxPro and I would like to be able to create a database and store and retrieve information from it. What is the simplest way to do it and what should I be...
2
by: Frank | last post by:
Can I do this? I add a session var in C# and ultimatly want to pass it into a vbscript client side activeX control. This is what I have so far but get " Object Required:'name2' " error. Can...
3
by: Kees de Winter | last post by:
Hi, If I have a TextBox place inside a content placeholder then at runtime the TextBox's name changes to ctl00_ContentPlaceHolder1_tbCity. What is the best way to get the value of the TextBox...
3
by: bazubwabo | last post by:
hi everybody , could u please help me to find out the error on my asp codes,i can't retrieve the inserted values. Here is below the code: <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!DOCTYPE...
3
by: Fran | last post by:
(SQL 2005) I'm looking to create a stored procedure to first "select name from sys.databases where name like '%site'" then pass each name to the following using some kind of loop "USE @name select...
21
by: giandeo | last post by:
Hello Experts. Is it possible to retrieve the value from a populated pull down menu from a database and then use that value to access the same database to get the related fields. Example: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.