Retrieve IIS Applicaton Path

Discussion in 'ASP General' started by Raterus, Jan 12, 2007.

  1. Raterus

    Raterus Guest

    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).

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

    Any help is much appreciated!
    --Michael
    Raterus, Jan 12, 2007
    #1
    1. Advertising

  2. Raterus

    Raterus Guest

    I found an answer,

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

    Call Response.Write(ApplicationPath() & "<br><br>")

    "Raterus" <> wrote in message news:%...
    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).

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

    Any help is much appreciated!
    --Michael
    Raterus, Jan 12, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ashish Gupta

    Applicaton on Handhelp using ASP.NET

    Ashish Gupta, Jul 1, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    384
    Peter McMahon [MVP]
    Jul 1, 2003
  2. nick
    Replies:
    3
    Views:
    481
    veera
    Jul 6, 2004
  3. =?Utf-8?B?QWxleCBLdWRha292?=

    Debugging local ASP.Net applicaton on WinXP.SP2

    =?Utf-8?B?QWxleCBLdWRha292?=, Jan 26, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    371
    Andy G
    Jan 26, 2005
  4. guoqi zheng
    Replies:
    2
    Views:
    435
    Mark Rae
    Apr 16, 2005
  5. Replies:
    2
    Views:
    1,862
    GloryFish
    Oct 21, 2005
Loading...

Share This Page