Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Actually i created one registration form in asp.net....i wanna get real ip address, who all register in my register form????
Posted

1 solution

This might be the best solution , to get the IP address

C#
public string GetUserIP()
       {
           string ipList = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

           if (!string.IsNullOrEmpty(ipList))
           {
               return ipList.Split(',')[0];
           }

           return Request.ServerVariables["REMOTE_ADDR"];
       }
 
Share this answer
 
Comments
Deenuji 18-Nov-12 5:17am    
Sir....I need those code in c#....can u help me sir...
Deenuji 18-Nov-12 5:19am    
Actually I wanna trace all users whose r using my application...for that ly i need to get those ipaddress...so pls help me?????
Pro Idiot 18-Nov-12 5:20am    
The above code is in C# , Call the function and it will return you the user's Client IP
Deenuji 18-Nov-12 5:27am    
thank u sir....sir!!! pls i wanna keep touch with u!!!! how i can reach u sir?????
Pro Idiot 18-Nov-12 5:35am    
If the solution helped, Mark as Answer.

U can reach via CP profile .

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