Get IP Address of Client Machine

To achieve this use below line of code:

  1. string IPAddress = string.Empty;  
  2. IPAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];  
  3. if (IPAddress == "" || IPAddress == null)  
  4.     IPAddress = Request.ServerVariables["REMOTE_ADDR"];  
  5. Response.Write("<b>Your Machine IP Address is: </b>" + IPAddress); 

 
                                                                        Image 1. 
Ebook Download
View all

Pristine

Read by 0 people
Download Now!
Learn
View all