Search code examples
.netcassini

How to determine if Cassini is what's running your web app?


Basically, the question in the title - how can I / is it possible to determine that Cassini is what's running my app versus IIS? Basically I want my code to know that it's debugging, so if I'm missing something easier here, please point it out.


Solution

  • While I like a lot of the ideas here, I think I found a simple way to accomplish this.

    System.Diagnostics.Debugger.IsAttached
    

    This gives a boolean depending on whether there's a debugger attached to the executing code.

    I still like the #if code provided by vc 74, but this code serves my purpose better.