Logging Server Name & Server IP

Ewonhrc

New Member
When an exception is thrown, we log it. However, we are unable to retrieve the server name or I.P address. Not sure if this is the right way to retrieve it.
\[code\]Log.ServerName = HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"];\[/code\]
\[code\]Log.ServerIP = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];\[/code\]This doesn't seem to work. It returns 'localhost' and ::1 as the I.P address.
 
Back
Top