Mike said:
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