Wednesday, 16 May 2012

How to get System IP addres and Track Browser Details using Asp.net

 //Track IP Address
        string myHost = System.Net.Dns.GetHostName();
        string str = System.Net.Dns.GetHostByName(myHost).AddressList[0].ToString();
        Response.Write(str.ToString());

        //Track Browser Details
        Response.Write("<B>User Agent ::</B> " +Request.UserAgent+"<BR>");
        Response.Write("<B>Browser ::</B> "+Request.Browser.Browser+"<BR>");
        Response.Write("<B>Version ::</B> "+ Request.Browser.Version+"<BR>");
        Response.Write("<B>Major::</B> "+Request.Browser.MajorVersion+"<BR>");
        Response.Write("<B>Minor::</B> "+Request.Browser.MinorVersion+"<BR>");