Saturday, February 11, 2012

Find IP Address in ASP.NET Behind Proxy


public string IpAddress()
{
string strIpAddress;
strIpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (strIpAddress == null)
{
strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
}
return strIpAddress;
}

To find IP address of a machine behind LAN you can use this code
string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses
(strHostName).GetValue(1).ToString();

1 comment :

  1. www.smartsoft.in , A Hyderabad (India) based MLM Software Development company having a team of 40 full time professionals who are experts in delivering software solutions for ecommerce & ERP solutions in India and abroad.
    SmartSoft was started in Oct 2000 with small desktop MLM Software designing and now having capacity to develop any kind of ecommerce & statutory softwares with in-depth knowledge and experience. You may look into our esteemed clients list for your ready reference in this document, Please excuse us as there are some more clients we serve but we should not list them here as there is a NDA agreed in the contract terms. However we are privileged to refer verbally.
    Our vast experience in Softwares Development over 14 years enables us to deliver the MLM software solutions & services to suit any type of business models on time. We deliver perfect solutions to all sorts of marketing concepts with multiple & advanced features that are in demand as well as in latest trends. We are committed to provide perfect solutions to your unlimited Imaginations & ideas by executing the projects as per the specifications given by our clients

    ReplyDelete