Mike P wrote:
Hi,
During loading of the Global.asax, I need to get back the
"applicatio n 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("II sWebVirtualDir" , sWebVirtualDire ctoryName)
oVirtualDir.Pat h = sWebPath
oVirtualDir.Acc essRead = True
oVirtualDir.Acc essWrite = False
oVirtualDir.Acc essExecute = False
oVirtualDir.Aut hAnonymous = False
oVirtualDir.Aut hBasic = True
oVirtualDir.Aut hNTLM = True
oVirtualDir.Con tentIndexed = False
oVirtualDir.Ena bleDirBrowsing = False
oVirtualDir.App Isolated = False
If InStr(1, oVirtualDir.Def aultDoc, "Default.as p") = 0 Then
oVirtualDir.Def aultDoc = "Default.as p, " & oVirtualDir.Def aultDoc
End If
Call oVirtualDir.App Create(True)
oVirtualDir.App FriendlyName = sWebVirtualDire ctoryName
Call oVirtualDir.Set Info()
Set oVirtualDir = Nothing
Set oIIS = Nothing
--
Thanks,
Carl Prothman
Microsoft ASP.NET MVP
Hire top-notch developers at
http://www.able-consulting.com