0
I have an application running on local IIS and also in production. In this application, I have a feature where, when an error occurs, an email is sent. The problem is I don’t want that to happen when I’m in a development environment.
I thought about determining some environment variable to do this on IIS (but I want this variable to be specific to this application).
Is there any way to define specific environment variables for an application running on IIS?
have tried the web.config ?
– Rovann Linhalis
I suggest using the debug mode option, and it is only enabled in the test environment: https://msdn.microsoft.com/pt-br/library/e8z01xdh.aspx
– Rovann Linhalis
@Rovannlinhalis um... how would I do that? I’m really messing with C# and derivatives for a little while, all help is welcome.
– Wallace Maxters
I believe it is just to check, with an if:
if(HttpContext.Current.IsDebuggingEnabled
)
– Rovann Linhalis
@Rovannlinhalis but how will IIS know it is debug or not? That’s the question. You’re talking about that flag
debug=true
ofcompilation
?– Wallace Maxters
yes, I will elaborate an answer, but ask you to take a test. I have no way to test it now. If it goes wrong, let me know to remove ok ?
– Rovann Linhalis