Reputation: 196781
I have some code that generates an email and I want to include the actual server machine name that is running in the body of the email. (It's a clustered web environment, so I want to find out what actual machine is sending the email.)
I know I can use Request.Url.AbsoluteUri
, but that gives me the URL (like www.mysite.com/MyController/Action) instead of the raw actual machine name - which might be MACH3234k323).
Is there a way that I can get the actual server machine's name?
Upvotes: 45
Views: 35391
Reputation: 1018
The name of the machine will be here:
System.Environment.MachineName
Upvotes: 23