Retrieve IIS Applicaton Path

Retrieve IIS Applicaton Path

am 12.01.2007 18:05:05 von Raterus

I need to routine that will return what 'Request.ApplicationPath' would =
return in asp.net.

If you are not familiar with that, I just need to know the IIS virtual =
directory the application is running in, relative to the server root.

I've looked through all the server variables, but don't see anything =
that will help me, without having to do some string parsing (and even =
then I'd be guessing at the virtual directory).=20

A return value would look something like this...where "myapp" is the =
virtual directory
"/webapps/myapp/"

Any help is much appreciated!
--Michael

Re: Retrieve IIS Applicaton Path

am 12.01.2007 20:15:09 von Raterus

I found an answer,

Function ApplicationPath()
sApplicationPath =3D =
LCase(Request.ServerVariables("APPL_MD_PATH"))
ApplicationPath =3D Split(sApplicationPath, "root")(1)
End Function

Call Response.Write(ApplicationPath() & "

")

"Raterus" wrote in message =
news:%23UhFQvmNHHA.2028@TK2MSFTNGP03.phx.gbl...
I need to routine that will return what 'Request.ApplicationPath' would =
return in asp.net.

If you are not familiar with that, I just need to know the IIS virtual =
directory the application is running in, relative to the server root.

I've looked through all the server variables, but don't see anything =
that will help me, without having to do some string parsing (and even =
then I'd be guessing at the virtual directory).=20

A return value would look something like this...where "myapp" is the =
virtual directory
"/webapps/myapp/"

Any help is much appreciated!
--Michael