473,385 Members | 2,015 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,385 software developers and data experts.

Retrieving The Application Name Programatically

Hi,

During loading of the Global.asax, I need to get back the "application name"
that is configured in IIS. I have scoured the Http classes but there does
not seem to be any way to get to it. I know in IIS 6.0, I could retrieve it
through metabas.xml but I need this solution to work on Windows 2000, IIS
5.0 as well.

Many Thanks in advance for your help

Mike
Nov 18 '05 #1
3 3452
Mike P wrote:
Hi,

During loading of the Global.asax, I need to get back the
"application name" that is configured in IIS. I have scoured the Http
classes but there does not seem to be any way to get to it. I know in
IIS 6.0, I could retrieve it through metabas.xml but I need this
solution to work on Windows 2000, IIS
5.0 as well.


Mike,
Take a look a the Virtual Directory's AppFriendlyName property.

The following is how I created an IIS 5.x Virtual directory back in classic ASP
using vbscript:
' Create a new IIS Virtual Directory which points to the newly created Physical directory
Set oIIS = GetObject("IIS://" & sWebServerName & "/W3SVC/1/root")

' Note: the virtual directory that this ASP is ran from must have "Out-Process" un-checked,
' and "NT challenge/repsponse" must be checked, and "Anon" must be un-checked.
' Or else you will get a permission error on this line.
Set oVirtualDir = oIIS.Create("IIsWebVirtualDir", sWebVirtualDirectoryName)
oVirtualDir.Path = sWebPath
oVirtualDir.AccessRead = True
oVirtualDir.AccessWrite = False
oVirtualDir.AccessExecute = False
oVirtualDir.AuthAnonymous = False
oVirtualDir.AuthBasic = True
oVirtualDir.AuthNTLM = True
oVirtualDir.ContentIndexed = False
oVirtualDir.EnableDirBrowsing = False
oVirtualDir.AppIsolated = False
If InStr(1, oVirtualDir.DefaultDoc, "Default.asp") = 0 Then
oVirtualDir.DefaultDoc = "Default.asp, " & oVirtualDir.DefaultDoc
End If
Call oVirtualDir.AppCreate(True)
oVirtualDir.AppFriendlyName = sWebVirtualDirectoryName
Call oVirtualDir.SetInfo()
Set oVirtualDir = Nothing
Set oIIS = Nothing

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

Hire top-notch developers at
http://www.able-consulting.com
Nov 18 '05 #2
Carl,
Are you using WMI to do this? I can find no other reference for doing this
than WMI.

Thx

Mike
"Carl Prothman [MVP]" <ca****@spamcop.net> wrote in message
news:O2**************@TK2MSFTNGP12.phx.gbl...
Mike P wrote:
Hi,

During loading of the Global.asax, I need to get back the
"application name" that is configured in IIS. I have scoured the Http
classes but there does not seem to be any way to get to it. I know in
IIS 6.0, I could retrieve it through metabas.xml but I need this
solution to work on Windows 2000, IIS
5.0 as well.

Mike,
Take a look a the Virtual Directory's AppFriendlyName property.

The following is how I created an IIS 5.x Virtual directory back in

classic ASP using vbscript:
' Create a new IIS Virtual Directory which points to the newly created Physical directory Set oIIS = GetObject("IIS://" & sWebServerName & "/W3SVC/1/root")

' Note: the virtual directory that this ASP is ran from must have "Out-Process" un-checked, ' and "NT challenge/repsponse" must be checked, and "Anon" must be un-checked. ' Or else you will get a permission error on this line.
Set oVirtualDir = oIIS.Create("IIsWebVirtualDir", sWebVirtualDirectoryName) oVirtualDir.Path = sWebPath
oVirtualDir.AccessRead = True
oVirtualDir.AccessWrite = False
oVirtualDir.AccessExecute = False
oVirtualDir.AuthAnonymous = False
oVirtualDir.AuthBasic = True
oVirtualDir.AuthNTLM = True
oVirtualDir.ContentIndexed = False
oVirtualDir.EnableDirBrowsing = False
oVirtualDir.AppIsolated = False
If InStr(1, oVirtualDir.DefaultDoc, "Default.asp") = 0 Then
oVirtualDir.DefaultDoc = "Default.asp, " & oVirtualDir.DefaultDoc
End If
Call oVirtualDir.AppCreate(True)
oVirtualDir.AppFriendlyName = sWebVirtualDirectoryName
Call oVirtualDir.SetInfo()
Set oVirtualDir = Nothing
Set oIIS = Nothing

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

Hire top-notch developers at
http://www.able-consulting.com

Nov 18 '05 #3
Mike P wrote:
Are you using WMI to do this? I can find no other reference for doing
this than WMI.


No, I believe the code is using Active Directory Service Interfaces (ADSI)
http://msdn.microsoft.com/library/en...chitecture.asp

BTW here is some VB.NET code which will get the friendly name for you.

Dim sWebServerName As String = "carl20"
Dim sWebVirtualName As String = "temp1"
Dim sWebVirtualFriendlyName As String = ""

' Create a new IIS Virtual Directory which points to the newly created Physical directory
Dim oVirtualDir As Object = GetObject("IIS://" & sWebServerName & "/W3SVC/1/root/" & sWebVirtualName)
sWebVirtualFriendlyName = oVirtualDir.AppFriendlyName

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

Hire top-notch developers at
http://www.able-consulting.com
Nov 18 '05 #4

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

Similar topics

1
by: md | last post by:
I recently installed Windows XP SP2 (Had no problems with it at all FWIW). One of the applications I am writing has a server piece that communicates on a TCP/IP port that is blocked by default in...
2
by: Mick White | last post by:
<thead> <tr id="header"> <th><a href="#" onclick="sortTable('rhinos',this.id,sortNumerical);" id="col0" >#</a></th> <th><a href="#" onclick="sortTable('rhinos',this.id,sortByPosition);"...
8
by: Steve | last post by:
Can anyone tell me the preferred method for writing and retrieving persistent information using .Net. Specifically, I am referring to information that you used to see in registry keys or .ini...
2
by: Sven Wynsberghe | last post by:
Like the topic states, is there any way I can get the ip-adress of my computer with a vb.net application? thanks for the help :)
2
by: Rick Derthick | last post by:
Hello, I'm adding a logging capability to error handler routines for troubleshooting (using vb.net) and had just recently come across a way to programatically determine the name of the...
5
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
9
by: =?Utf-8?B?QmFkaXM=?= | last post by:
Hi, I'm using automation and it's working fine when I run it from my local machine. but if I try to access it from another machine it's giving me this Error: Retrieving the COM class factory...
2
by: =?Utf-8?B?UGF1bA==?= | last post by:
I am using ASP.Net 2.0 and VB.Net (although C#is ok also). I want to create an object/method/function that will take a URL as an input parameter and then return all of the HTML in that page. I...
4
jhardman
by: jhardman | last post by:
Say I have a hypothetical db table of images, one column might be a name, one a url with the source of the image (the images aren't blobs in the db, just referenced) and a column with a category...
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:
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.