How to detect if executing under IIS

Discussion in 'ASP .Net' started by Gaetan, Oct 20, 2005.

  1. Gaetan

    Gaetan Guest

    I have ASP.Net code calling methods in an assembly. Those same methods can be called from
    a Windows service as well.

    I would like the methods to access data stored in the Application object only when running
    under IIS.

    Is there a quick way to detect whether the methods are running under IIS? I'm using IIS
    6.0 btw.

    Thanks.
    Gaetan, Oct 20, 2005
    #1
    1. Advertising

  2. When not under IIS, the HttpContext.Current would be null.

    "Gaetan" <> wrote in message
    news:eek:...
    >I have ASP.Net code calling methods in an assembly. Those same methods can
    >be called from
    > a Windows service as well.
    >
    > I would like the methods to access data stored in the Application object
    > only when running
    > under IIS.
    >
    > Is there a quick way to detect whether the methods are running under IIS?
    > I'm using IIS
    > 6.0 btw.
    >
    > Thanks.
    Peter Rilling, Oct 20, 2005
    #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. Jean-Claude Garreau
    Replies:
    5
    Views:
    307
    Roger Upole
    Mar 28, 2006
  2. Replies:
    1
    Views:
    393
    Victor Bazarov
    Feb 22, 2006
  3. Whiskey Romeo Lima
    Replies:
    1
    Views:
    551
    Whiskey Romeo Lima
    Jul 16, 2009
  4. vhaerun vh
    Replies:
    16
    Views:
    274
    Eleanor McHugh
    Sep 8, 2009
  5. Tom Salzmann
    Replies:
    3
    Views:
    250
Loading...

Share This Page