The closest your probably going to get with what you want is the machine name:
System.Environment.MachineName
localhost is an address, and every machine can access itself through it (assuming someone didn't monkey with the hosts file).
You could get the URL accessing the page: Request.Url.AbsoluteUri
. This will tell you most likely what environment they are trying to hit (except if they use local host to access the site).
If the server is localhost, then send
email notification to [email protected] If
the server is QA, then send email to
[email protected]
If you have access to the machine config, an easier way might be to place the email address in the appsettings you want to send emails to there. That way you can vary it by environment and not worry about what machine/url they are trying to hit.