读本地文件..... [英] Read local file.....
问题描述
所以我知道我认为读取本地文件作为安全问题的所有限制。但是我正在构建一个用户将在其内部网页下登录的网络应用。我需要一个文本文件,所以我知道它来自哪个设备用于跟踪。有没有办法绕过这个来读取本地机器上的文件,或者我可以获取设备的另一个值(示例MAC地址)?所以像设备123456我会有一个数据库,说这是大鸟笔记本电脑等。
我现在读它的文件,但它的本地服务器端文件。不是设备。
谢谢
我尝试了什么:
我使用streamReader读取服务器端文件,但这不是我想要的。通常你不想在本地做这个,但在这种情况下我做。
So I know of all the restrictions I think of reading a local file as its a security issue. However I am building a web "app" that a user will sign in under ( its an internal web page). I need a text file so I know what device its coming from for tracking. Is there anyway to get around this to read the file on the local machine or can I grab another "value" ( example MAC address ) of the device? So like device 123456 I would have a database that says this is "Big Birds" laptop etc..
I have it reading a file now but its the local server side file. Not the devices.
Thanks
What I have tried:
I have used the streamReader to read a server side file but that is not what I want. Normally you would not want to do this local but in this case I do.
推荐答案
你无法在浏览器中从设备中读取文件。
您也无法访问设备上的任何硬件,包括MAC地址。此外,MAC地址不能用作计算机或用户的唯一标识符。没有足够的地址可以做到这一点。
如果您正在跟踪用户,请使用用户电子邮件地址构建标识符。把它标识在一个cookie中,你可以在下次访问该网站时识别该用户。
识别一台机器要困难得多,因为可以很容易地删除cookie并且是基于用户的,而不是基于机器的。
您可能想要阅读这个主题 [ ^ ]了解更多信息。
You cannot read a file from the device in the browser.
You also cannot get at any of the hardware on the device, including the MAC address. Also, a MAC address can NOT be used as a unique identifier for a machine or user. There are simply not enough possible addresses to do that.
If you're tracking users, build an identifier using the users email address. Put that identified in a cookie and you can ID that user the next time they visit the site.
Identifying a machine is a LOT harder because cookies can be deleted very easily and are user-based, not machine based.
You might want to read this thread[^] for more information on it.
所以可以我在根目录中的PC上添加一个文件或类似的东西?我可以根据需要安装软件,因为我会设置所有这些。我们将使用基于Windows的平板电脑。
So could I add a file on the "PC" in the root directory or something like that? I can install software if needed as I will be setting all these up anyways. Its a windows based tablet is what we will be using.
这篇关于读本地文件.....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!