Monday, June 11, 2012

Get Machine Name and IP ASP.NET

My previous post has an function which is now deprecated.
http://metahat.blogspot.com/2009/09/get-client-machine-name-aspnet.html
System.Net.Dns.GetHostByAddress(Request.UserHostAddress).HostName


Following are the new function to get client machine name and IP address:

string[] computer_name = System.Net.Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName.Split(new Char[] { '.' });
                        
string machineName=computer_name[0].ToString();
string ipAddress  =Request.ServerVariables["REMOTE_ADDR"].ToString();

No comments:

Architecting Resilient application on AWS

 Great whitepaper on improving resiliency of distributed systems: https://docs.aws.amazon.com/whitepapers/latest/availability-and-beyond-imp...