Click here to Skip to main content
16,017,986 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Developers, I am stuck while fetching client side information of there device, I didn't want to show my server device info to client. i want who ever visit my site i get his/her Mobile/Laptop Name, Model, Os version, and all other info, Kindly help me out if some one knows , Thanks in advance , i HAVE Tried but this give me my server detail i didn't want that i want the client device info who ever visit my site


What I have tried:

protected void Page_Load(object sender, EventArgs e)
   {


       //devicename.Text = GetComputerName(Request.UserHostAddress);
        //Device Name\

       //IS 64 bit?
       bool os = Environment.Is64BitOperatingSystem;
       Label1.Text = os.ToString();

       //username Fetch
       string q1 = Environment.UserName;
       Label2.Text = q1;

       //Version Fetch

       string q2 = Environment.Version.ToString();
       Label3.Text = q2;

       //Os Version Fetch
       string q3 = Environment.OSVersion.ToString();

       HttpBrowserCapabilities browse = Request.Browser;
       string platform = browse.Platform;
       Label4.Text = platform;

       //Processor Count Fetch
       string q4 = Environment.ProcessorCount.ToString();
       Label5.Text = q4;

       //System Pages Fetch
       string q5 = Environment.SystemPageSize.ToString();
       Label6.Text = q5;

       //Working Set Fetch
       string q6 = Environment.WorkingSet.ToString();
       Label7.Text = q6;

       //Current Directory Fetch
       string q7 = Environment.CurrentDirectory.ToString();
       Label8.Text = q7;

       //Command Line Fetch
       string q8 = Environment.CommandLine.ToString();
       Label9.Text = q8;


       //Ip Address Fetch
       IPHostEntry host;
       string localIP = "?";
       host = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());

       foreach (IPAddress ip in host.AddressList)
       {

           if (ip.AddressFamily.ToString() == "InterNetwork")
           {

               localIP = ip.ToString();
               Label10.Text = localIP;
           }
       }


       //Current Data & Time Fetch
       DateTime date = DateTime.Now;

       location.Text = Convert.ToDateTime(date).ToString();

       //Mac Address Fetch
       string addr = "";
       foreach (System.Net.NetworkInformation.NetworkInterface n in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
       {
           if (n.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up)
           {
               addr += n.GetPhysicalAddress().ToString();
               break;
           }
       }
       mac.Text = addr;

   }
Posted
Updated 27-Oct-20 0:56am
Comments
F-ES Sitecore 27-Oct-20 6:58am    
Your code is running on the server so it is returning information about the server. You can only get info from the client that they send in headers or that is available to determine via javascript. It's unlikely you'll be able to get the data you are wanting for security reasons.

1 solution

You can't.
First off, C# code runs on the server, so any information it collects would be server related, not client.

Javascript code runs on the client, and that cannot access the users system to get the information you want for security reasons.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900