473,394 Members | 1,761 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,394 software developers and data experts.

root directory

Hi
How do I refer to the root of the IIS installation in code please?
TIA

--

Nov 19 '05 #1
7 1240
<dl> wrote in message news:uZ**************@TK2MSFTNGP15.phx.gbl...
How do I refer to the root of the IIS installation in code please?


Request.ServerVariables["APPL_PHYSICAL_PATH"]
Nov 19 '05 #2
Thanks, this is close. I will use it.
Can we get the FQDN or the hostname/computername of the IIS server, please?!
TIA
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
<dl> wrote in message news:uZ**************@TK2MSFTNGP15.phx.gbl...
How do I refer to the root of the IIS installation in code please?


Request.ServerVariables["APPL_PHYSICAL_PATH"]

Nov 19 '05 #3
<dl> wrote in message news:uC**************@TK2MSFTNGP14.phx.gbl...
Can we get the FQDN or the hostname/computername of the IIS server,
please?!


System.Environment.MachineName
Nov 19 '05 #4
That's not a fully qualified domain name.
It's only the machine name, which may be different.

Request.ServerVariables("HTTP_HOST")
returns the complete domain name.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:uh*************@TK2MSFTNGP15.phx.gbl...
<dl> wrote in message news:uC**************@TK2MSFTNGP14.phx.gbl...
Can we get the FQDN or the hostname/computername of the IIS server, please?!


System.Environment.MachineName

Nov 19 '05 #5
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:eF**************@TK2MSFTNGP09.phx.gbl...
That's not a fully qualified domain name.
It's only the machine name, which may be different.
You're right - I didn't read the reply properly - apologies.
Request.ServerVariables("HTTP_HOST")
returns the complete domain name.


Yes indeed.
Nov 19 '05 #6
Thanks guys. Is there a place I can refer to for a list of such
"variables"?

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:Oa****************@tk2msftngp13.phx.gbl...
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:eF**************@TK2MSFTNGP09.phx.gbl...
That's not a fully qualified domain name.
It's only the machine name, which may be different.


You're right - I didn't read the reply properly - apologies.
Request.ServerVariables("HTTP_HOST")
returns the complete domain name.


Yes indeed.

Nov 19 '05 #7
re:
Is there a place I can refer to for a list of such "variables"?
I use this handy dynamic page to list them :

servervars.aspx :
-----------------
<%@ Page Language="vb" %>
<%@ Import Namespace = "System.Web" %>
<script runat="server">

Public Sub Page_Load(Sender As System.Object, E As System.EventArgs)

'Server Variables
Dim vars As NameValueCollection = Request.ServerVariables

If Not IsPostBack Then
Names.DataSource=vars
Names.DataBind()
Else
ValuesHead.Text = "Values: "
If vars.Get(Names.SelectedItem.Text).ToString() = Nothing Then
Values.Text = "null"
Else
Values.Text = vars.Get(Names.SelectedItem.Text).ToString()
End If
End If
End Sub

</script>
<html>
<head>
</head>
<body>
<form id="Form1" runat="server">
<h3>Retrieving Server Variables
</h3>
<p>
Retrieve:
<asp:DropDownList id="Names" runat="server" AutoPostBack="true"></asp:DropDownList>
<br />
<asp:Label id="ValuesHead" runat="server"></asp:Label>
<br />
<b><asp:Label id="Values" runat="server" backcolor="Beige" width="500"></asp:Label></b>
</p>

</form>
</body>
</html>
-----------

That way, I have all the variables, and their names, easily available.

Remember that the general format for retrieving server variables is :

Request.ServerVariables("VARIABLE_NAME")

Also, there's quite a few equivalents in the native .Net class system.web,
by retrieving the properties for System.Web.HttpRequest .

See :
http://www.csharpfriends.com/quickst...ss=HttpRequest

If you prefer using a .net native method, that's the way to go.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

<dl> wrote in message news:OV**************@TK2MSFTNGP14.phx.gbl... Thanks guys. Is there a place I can refer to for a list of such
"variables"?

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:Oa****************@tk2msftngp13.phx.gbl...
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:eF**************@TK2MSFTNGP09.phx.gbl...
> That's not a fully qualified domain name.
> It's only the machine name, which may be different.


You're right - I didn't read the reply properly - apologies.
> Request.ServerVariables("HTTP_HOST")
> returns the complete domain name.


Yes indeed.


Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ed | last post by:
Hello, I took a course in asp about 2 years ago and I was practicing with IIS 5.0. Then I put it down for a while. Now trying to get back to it. I can't run asp files from subdirectories of...
5
by: Leszek | last post by:
Hello, Could anybody explain what's a difference between a virtual directory and an application root under IIS? I'm a little bit confused. This is mu problem: Let's assume the following...
7
by: Bennett Haselton | last post by:
If you create a ASP.Net Web application in Visual Studio .Net, you apparently have to specify the target as a directory on a web server, e.g. www.hostname.com/dirname, with "dirname" being the name...
4
by: Jerry | last post by:
I'm having just a bit of trouble wrapping my brain around the task of working with folders that are above the site's root folder. I let users upload photos (.jpg/.gif files) which can...
4
by: Win, Pats | last post by:
I have a snippet of HTML that I inject into a number of pages throughout my Web site at runtime. My problem is that I'm not getting the image to appear in all documents into which this snippet is...
19
by: Steve Franks | last post by:
I am using VS.NET 2005 beta 2. When I run my project locally using the default ASP.NET Development Web Server it runs using a root address like this: http://localhost:11243/testsite/ However...
3
by: Nalaka | last post by:
Hi, I have an asp.net web application (www.myWebSite), and a subweb application (www.myWebSite/subSite). How do I set it so that, subweb application (www.myWebSite/subSite) be the root...
8
by: news.microsoft.com | last post by:
I have two completely distinct ASP.NET (2.0) web applications. They share no code, they have distinct web.config files, they don't even link to each other. During development, they have lived...
4
by: =?Utf-8?B?SnVhbiBEZW50?= | last post by:
Hi, I am getting the following in a VC++ EXE (using VS2005) that links several C++ DLLs and uses MFC and ATL, when I try to start it under the debugger: ------- 'Exactus.UX.Studio.v1.exe':...
6
by: littlelisper | last post by:
I want to open an XML file with my browser. The file contains the following line: <?xml-stylesheet type="text/xsl" href="/new.xsl"?> which points to the root node to look for the stylesheet....
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.