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;

            

            }

       }

3 comments:

  1. Do you mind if I quote a couple of your posts as long as I provide credit
    and sources back to your blog? My website is in the very same area
    of interest as yours and my users would definitely benefit from a
    lot of the information you present here. Please
    let me know if this ok with you. Appreciate it!


    My web-site: Your Domain Name

    ReplyDelete
    Replies
    1. Hi, Thanks for showing interest in my Blog posts.
      Can you give me the URL of your website where you want to share this.

      Thanks

      Delete
  2. Hey there! I'm at work surfing around your blog from my new apple iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Keep up the fantastic work!

    My web-site :: relevant webpage

    ReplyDelete

Total Pageviews