如何在asp.net中仅为重复请求启用验证码 [英] How to enable captcha only for repeated requests in asp.net

查看:85
本文介绍了如何在asp.net中仅为重复请求启用验证码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,



我的应用程序中存在问题,我想在其中启用验证码选项如果服务器从同一IP地址同时获取请求。也就是说,如果我的网站在短时间内(例如10秒)收到来自同一IP地址的10个或更多请求,则应该为该IP地址启用验证码...



可以有人知道怎么做...



请用你的知识指导我..



提前谢谢...

Hi experts,

I have a problem in my application, in which I want to enable Captcha Options If the Server gets simultaneous requests from the same IP address. That is, If my website receives 10 or more requests from the same IP address within the short time period (say 10 seconds), then the captcha should be enabled for that IP address...

Can Anybody know how to do this...

Please guide me with your knowledge..

Thanks in advance...

推荐答案

获取客户端的实际IP地址没有万无一失的方法。如果客户端位于防火墙或代理或NAT后面,则您获得的IP将不正确。您可以尝试使用ASP.NET会话ID来检查请求是否来自以前的客户端。



您要做的是存储来自同一会话ID的请求列表在列表中以及每个新请求中,选中此列表以查看过去X秒内收到的请求数,并采取相应步骤。
There is no foolproof way to get the actual IP address of the client. If the client is sitting behind a firewall or a proxy or a NAT, the IP you get will be incorrect. You can try using the ASP.NET Session Id to check if the request came a previous client.

What you do is store the list of requests from the same Session Id in a list and with every new request, check this list to find out how many requests you've received in the past X seconds and take steps accordingly.


这篇关于如何在asp.net中仅为重复请求启用验证码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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