views:

75

answers:

3

In my code behind I'd like to be able to tell that I'm running my web site project in Visual Studio (either Debug or Release).

I was considering testing for "localhost" but that's not perfect because we could be testing it locally on the server.

Any ideas?

+5  A: 

Not exactly what you are asking for, but you check for

System.Diagnostics.Debugger.IsAttached == true
cdonner
it works good enough. thanks!
mga911
A: 
this.Server.MachineName

Might help...

Paul Creasey
A: 

This one works in either debug or release mode:

if (!String.IsNullOrEmpty(this.Request.ServerVariables["SERVER_SOFTWARE"]))
{
    // you're running in IIS, not Cassini
}
RickNZ