Mapping Paths with no context

Discussion in 'ASP .Net' started by Michael McDaniel, Jul 18, 2003.

  1. I have overridden HttpApplication in my class library.

    When my application starts, There are configuration files that I need to
    load in order for my application to work correctly. This works great,
    however, I now have a config file that I need that is located on a
    virtual mapped path within iis.

    During my HtppApplication load, I have no HttpContext, hence my problem.
    How do I map a path when I have no Current Context?


    string _VirtualPath = "/settings.config";

    System.Web.HttpContext context =
    System.Web.HttpContext.Current;
    if (File.Exists(System.Web.HttpRuntime.AppDomainAppPath + _VirtualPath))
    {
    _PhysicalPath =
    System.Web.HttpRuntime.AppDomainAppPath + _VirtualPath;
    }
    else if (context != null)
    {
    _PhysicalPath = context.Server.MapPath(_VirtualPath);
    }




    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Michael McDaniel, Jul 18, 2003
    #1
    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. Samuel Kim

    Mapping paths to aspx pages

    Samuel Kim, Feb 21, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    425
    Matt Berther
    Feb 21, 2005
  2. Replies:
    1
    Views:
    648
    IchBin
    Jul 31, 2005
  3. David Kerber

    Deep context paths in Tomcat 5.5?

    David Kerber, Sep 30, 2005, in forum: Java
    Replies:
    0
    Views:
    379
    David Kerber
    Sep 30, 2005
  4. Noah
    Replies:
    5
    Views:
    846
  5. Ohad Lutzky

    Paths, gentleman, paths

    Ohad Lutzky, Nov 6, 2006, in forum: Ruby
    Replies:
    2
    Views:
    223
    David Vallner
    Nov 7, 2006
Loading...

Share This Page