Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
hi
can i get ip address of another system in chatting time
Posted
Comments
Sergey Alexandrovich Kryukov 20-Dec-11 9:12am    
Why? HTTP-based chat does not require it.
--SA

1 solution

Try this...

C#
string ip;
  if (Context.Request.ServerVariables["HTTP_VIA"] != null) // using proxy
  {
      ip = Context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
      // Return real client IP.
  }
  else// not using proxy or can't get the Client IP
  {
      ip = Context.Request.ServerVariables["REMOTE_ADDR"].ToString();
      //While it can't get the Client IP, it will return proxy IP.
  }
 
Share this answer
 
Comments
ThomasCarmen 22-Dec-11 20:24pm    
Cool!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900