None of the methods suggested will determine if you are started from the
IDE. You can come to the same conclusion by testing this code (perhaps in
page_load).
Debug.WriteLine("DebugWriteLine")
#If DEBUG Then
Debug.WriteLine("If Debug> DebugWriteLine")
#Else
Debug.WriteLine("Else Release> DebugWriteLine")
#End If
If System.Diagnostics.Debugger.IsAttached() Then
Debug.WriteLine("Debugger Is Attached")
Else
Debug.WriteLine("Debugger Is Not Attached")
End If
If the project is in Debug mode, and started with F5, you get everything you
expect.
If the project is in Debug mode, and started with Ctrl-F5, you can still see
the debug output, but you have to use an external debug catcher (e.g.
dbgview from
www.sysinternals.com). You get the output you expect.
If you set the project to Release mode, you get nothing, but only because I
used Debug.Writeline; your program would execute the #Else code.
So we still have the question how to determine if the IDE started the
program? Still looking.