每个 IP 一键单击
在我的 asp.net mvc 应用程序中,我只需要允许一次单击,或者更确切地说,每个 IP 仅由按钮单击触发一次计算。例如:每个用户只能投票一次。用 C# 可以做到这一点吗?请问从哪里开始比较合适?如果我需要重新表述这个问题,请告诉我。谢谢!
In my asp.net mvc application I need to allow only one click, or rather calculation triggered by the button click only once per IP. E.g : Each user can vote only once. Is it possible to do this with C#? Where is a right place to start please ? Let me know if I need to rephrase the question.Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有很多方法可以做到这一点,我已经用我的应用程序完成了。
第一个 IP 地址是一个好方法,尽管不是 100%,因为许多人可以共享一个 IP 地址,而且人们可以重新启动连接并获取新的 IP 地址。因此,将选民的 IP 地址存储在数据库中是一个好的开始。
其次你可以使用cookies。这也不是 100% 安全的方法,因为人们可以删除它们。但是您可以将其与 IP 地址结合使用。
第三,如果您有 Facebook 应用程序,您可以在这里获得最佳的安全性。您只需检查 Facebook 用户 ID。如果您让选民也使用 Facebook 登录,即使您的应用程序不是页面选项卡上的自定义 Facebook 应用程序,您也可以执行此操作。
因此,为了编码,您需要一个数据库来存储这些值并在查看时进行检查。然而,在高流量站点中,它会导致数据库负载很大,因此一些缓存也是一个好的开始(如果您使用共享网格/网络场托管,请确保您的缓存不是进程中的)
There are numerous ways to do this, that I have done with my app.
First IP address is a good way, though not 100% as many people can share a single IP address and also people can restart their connections and get a new IP address. So storing voters IP addresses in the database is a good start.
Second you can use cookies. That again isn't a 100% secure approach as people can delete them. However you can use this in conjuction with IP address.
Third if you have a Facebook app, this is where you can get the best security. You just check the Facebook UserId. You can do this if you make your voters login with Facebook as well, even if your app isnt a custom Facebook app on a page tab.
So for coding sakes you need a database to store these values and check against when viewing. However in a high traffic site it lends itself to being very DB heavy, so some caching is also a good start (if you are on shared grid/webfarm hosting make sure your cache is not inprocess)
是的,完全同意 Joel Coehoom 的观点。
我建议在这种情况下使用 MAC 地址。
如需有关此问题的帮助,请尝试以下链接:
PhysicalAddress
<一个href="http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/1344dad4-dffe-486c-bf30-1b75d21fc9ba/" rel="nofollow noreferrer">使用获取客户端计算机的 MAC 地址C#
Yes, Totally agreed with Joel Coehoom.
I would suggest to use MAC address in this case.
For help about this try these following links:
PhysicalAddress
Get MAC address of client machine using C#