Thursday, January 17, 2013

Find the IPAddress of any User


protected void Page_Load(object sender, EventArgs e)

       {

            string ipadd = string.Empty;

            //"HTTP_X_FORWARDED_FOR" will return the user ipadd if client is behind proxy server          

            ipadd = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

            if (string.IsNullOrEmpty(ipadd))

            {

                //"REMOTE_ADDR" will return the ipaddress of router                

                ipadd = Request.ServerVariables["REMOTE_ADDR"];

                Label2.Text ="your ipaddress is" + ipadd;

            

            }

       }

Total Pageviews