When I use ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia")
in a webpage, it provides server informations. But I need computers information of any user that is using the website. I prepared an website including Win32_PhysicalMedia query. However it returns only the server computers information. Is it possible to get personal computers information from a web site?
Thanks.
CodePudding user response:
Well of course any computer code running on the web server can get information about the web server that running that code.
However, the client side?
that is a browser, and what happens if you running a iPad, or Andriod phone? Such information about the client side is not possbile.
Why? Well, when you come to my web site to view a cute cat picture? I can't have code run on YOUR computer that mucks around, looks for a document called "my passwords", or looks for files called banking. Or how about I mess around and steal all your family pictures?
If you could do that, the internet would be the worlds worst system and it would repsrent no security at all.
So, information about the client side computer that you can get?
Well, you can get information about what kind of browser they are using. and some Javascript on that web page can get say the current screen resolution (or better said the size of the browser window).
but, things like what OS, the hardware, and all your banking information and files and things about that computer? Nope, that is 100% hands off, and browser are VERY much securied, and are what we called sandboxed VERY tight. For example, while you can drop say a file-Upload control into a web page?
and that control will let the USER click on that button, and choose a file? You can't EVEN in JavaScript (browser side, client side script running) SET or CHOOSE or PICK the file name!!! - in other words, even that browser control is secured by NOT allowing you the develop to pick a local file. Again, this is for reasons of secuirty, since again as noted, while you look at my web site cute cat pictures, you can't have browser code running around and grabbing your files from YOUR computer while you are looking at MY WEB site!!!!
So, browser code can't even select a file to up-load. The user MUST select the file, and then when you up-load that file, ONLY the file name is passed along with the file data (not even the file path name to the file on YOUR computer is sent to the web server. Again, this is all locked down for reasons of security.
If you need information about the client side computer, then you would have to provide a user with a program to download. They would run the desktop program, it would then do your type of hardware select query, gather the information and THEN send the data up to your web site (I guess you would create a web method, or so called web API for that desktop program to call and send the data to). Of course, you would need a program written for Android phones, apple phones, windows desktop, Apple desktops and even more choices.
So, web based software is VERY much locked down, and has ZERO abiliity to get information about the client side computer. As noted, you can in JavaScript get information about what browser the user is using. (but then again, say chrome runs on Android and desktop). And you can as noted get the current window size, which in most cases will tell you what screen resolution. And a good many browsers will also allow you to get the users current zoom level (I been wanting to track this information for a very long time - since after 125% zoom, some of my web pages look like garbage).
So, you have to grasp how the web and this supposed fad called the internet works. The client side, or client desktop computers (or phones) that interact with your web site are using a browser, and as noted, those browsers are VERY much locked down, and this is of course for good reason - that reason being security, and thus I can sleep well at night, that when I go to visit YOUR web site with a cute cat picture, your not then running code on my computer that is pocking and peeking around with my personal computer that is MY computer, and not YOUR computer.