In asp.net we can get IP Address of WebClient using Request object.and If User is Loggen in With Some Authentication like Forms,Windows or any other. we can also track detail of User Loggen in User on that Web Site.
string strIpAddress = string.Empty;
strIpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (strIpAddress == null)
{
strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
}
In above Code strIpAddress will Contain IP of Client machine..
this will not show up real IP if your Client is Behind LAN firewalls.
Request.ServerVariables["REMOTE_USER"]
the code in above line will returns UserName . If User is Loggen in..
Thanks.
A blog where you can find tutorials on ASP.Net, Ajax Control Toolkit, SQL Server 2008/2005, WCF, WPF, Silverlight, Azure and other Microsoft Technologies
Thursday, May 14, 2009
1 comment:
Comments posted on ASP.Net Ajax Tutorials Blog are moderated and will be approved only if they are on-topic and not abusive. Please email me or my team for tech-support or blogging related questions. Avoid including website URLs in your comments - Thanks Author
Subscribe to:
Post Comments (Atom)
Hai,
ReplyDeleteI found internet ip address using this site www.ip-details.comBut From Your Article i learned how to
"Get Remote Client's IP Address and UserName.".Thanks for your info.