如何唯一标识客户机在ASP​​.NET应用程序? [英] How to uniquely identify the client machine in an ASP.NET application?

查看:150
本文介绍了如何唯一标识客户机在ASP​​.NET应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在托管环境中运行,但客户端的本地网络中创建的打印作业的服务器应用程序(NAT后面,这种机制是不相关)。

I have a server application that runs in a hosted environment but creates print jobs in the client's local network (behind NAT; the mechanics of this is not relevant).

为了将打印作业发送到附连到工作站的打印机,我需要确定工作站。用户工作站之间走动,所以我不能用工作站/打印机用户永久关联。琐碎的解决办法是要求用户通过从列表中选择,以确定他是从登录的机器,例如,但这是一个不便和受到用户错误。

In order to send the print job to the printer that is attached to the workstation, I need to identify the workstation. The users move around between workstations, so I can't permanently associate a user with a workstation/printer. The trivial solution is to require the user to identify the machine he is logging in from, for instance by selecting from a list, but that's an inconvenience and subject to user error.

选项我已经消除了:


  • 主机头变量(无身份发送)

  • 缓存,支持用户选择的。这个有点满足了用户错误的可能性,但不是真的。

  • HTML5 DOM存储 - 不是由客户端浏览器支持

任何其他的想法?

编辑:我确实有这puttnig特定功能(创建打印作业)到一个胖客户端应用程序的选项。该应用程序可那当然进行配置,问题消失。但是,用户体验将遭受不必浏览器和一个Windows应用程序之间切换。

I do have the option of puttnig this particular function (create a print job) into a thick client app. The app can then of course be configured and the problem goes away. But the user experience will suffer from having to switch between the browser and a Windows app.

推荐答案

我将不讨论你的奇怪的情况下,只是回答你的问题:如何识别机

I won't discuss your strange scenario, just answer your question: how to identify a machine?

那么,有在当前时间没有近似形式的解与HTTP协议。所有机器共享相同的IP,因为它们是在NAT后面。你不能得到MAC地址。你不能得到硬件标识符。你不能保证所有机器的发送不同的页眉到服务器(即所有不同的浏览器/版本)。

Well, there is no close-form solution at current time with HTTP protocol. All machines share the same IP since they are behind NAT. You can't get MAC address. You can't get hardware identifiers. You can't be sure that all machine will send different headers to the server (ie. all different browsers/version).

您可以依靠饼干。尝试建立某种形式的的机器验证的,或更好,的机器识别的页面上,从每台机器浏览一次告知这是那台机器上使用打印机服务器,,然后设置一个永久性的Cookie 那台机器上。

You may rely on cookies. Try to create some form of machine authentication, or better, machine identification page, browse it once from each machine telling the server which is the printer to use on that machine, and then set a permanent cookie on that machine.

只要饼干不会被删除(也许你可以随时更新的cookie,你永远不知道...)你有一个的简单的机制。

As soon as cookies won't be deleted (maybe you can always renew the cookie, you never know...) you have a simple mechanism.

这是最好的,我可以建议:(

It's the best I can suggest :(

这篇关于如何唯一标识客户机在ASP​​.NET应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆