c#阻止特定ip_允许或阻止您网站中的特定IP

c#阻止特定ip

The more I use the .htaccess file the more I appreciate its value. My next valuable lesson in .htaccess security deals with allowing and blocking access to a web server from a specific IP address. Reasons for doing this include:

我使用.htaccess文件越多,我就越欣赏它的价值。 关于.htaccess安全性的下一个有价值的课程是关于允许和阻止从特定IP地址访问Web服务器的。 这样做的原因包括:

  • Keeping a known hacker/bot from accessing your website

    防止已知的黑客/机器人访问您的网站
  • Allowing only your IP address to view your website (while it's in development, for example)

    仅允许您的IP地址查看您的网站(例如,正在开发中)
  • Allowing only trusted persons into your website (if your users' IP's stay the same, that's more secure than user/pass)

    只允许受信任的人进入您的网站(如果您的用户的IP保持不变,那将比用户/通行证更安全)
  • Disallowing persons from a specified country (or any known location) from your website

    禁止来自您网站上指定国家(或任何已知位置)的人员

  • Banning persons from your website

    禁止人员进入您的网站

代码 (The Code)

<limit GET POST PUT>
order deny,allow
deny from 202.57.377.22
deny from 8.77.88.33
allow from all
</limit>

The above code bans the two IP addresses from accessing the website.

上面的代码禁止两个IP地址访问该网站。

Chances are you wont do this often. I do, however, believe that you should use this for your development server. Allowing only LAN users to access your development server prevents a search engine or hacker from getting to your website:

您很可能不会经常这样做。 但是,我确实相信您应该将此用于开发服务器。 仅允许LAN用户访问您的开发服务器可防止搜索引擎或黑客访问您的网站:

<limit GET POST PUT>
order deny,allow
deny from all
allow from 192.168.0.0/24
</limit>

Do you have any other reasons to ban IP addresses? Have any code to share? Please do!

您还有其他禁止IP地址的理由吗? 有任何代码要共享吗? 请做!

翻译自: https://davidwalsh.name/htaccess-security-allow-block-ips

c#阻止特定ip

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值