简体   繁体   中英

how to block certain ip's (users) to access my website?

anybody knows of blocking certain users (by IP) from accessing your website (website on asp.net mvc).

EDIT: I know that web-servers can do this as well, but I need this at the application level

It's better to do this in the web server.

However, if you want to do it in code, you can handle the Application.BeginRequest event, check Request.UserHostAddress , and call Response.End .

IIS允许您指定基于IP的阻止列表。

如果要在应用程序级别执行此操作,则可以从Request.UserHostAddress获取用户IP,然后在用户IP已保存在列表中的情况下将其重定向到希望用户访问的位置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM