IP限制错误消息 [英] IP restriction error message

查看:238
本文介绍了IP限制错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说,如果我使用"IP地址和域限制"来限制对站点子文件夹的访问,我将得到什么IIS错误消息?我需要使用一个自定义错误消息,例如不允许您的IP访问此站点",但是这可能吗?我问是否为此返回了相同的错误代码(例如,由于证书错误而返回的通用访问被拒绝),所以我将无法使用它.

Say, If I restrict access to a site's subfolder using "IP address and domain restrictions", what would be the IIS error message I would be getting? I need to use a custom error message like "Your IP is not allowed to access this site", but would that be possible? I am asking if the same same error code (like a generic access denied that is returned for Certificate error) is returned for this, then I won't be able to use it.

在"IP地址和域限制"规则下请求失败时,是否有可能获得唯一错误?

Is it possible to get a unique error when a request fail at the "IP address and domain restrictions" rule?

推荐答案

IIS将引发HTTP 403.6 - Forbidden: IP address rejected.

如果要显示自定义错误页面,请转到IIS管理器中的网站,并在IIS部分下查找错误页面",在操作"下的右侧,单击添加...",使用状态代码403.6填写窗口,然后选择您的操作.

If you want to display a custom error page then go to your website within the IIS Manager and look for "Error Pages" under the IIS section, on the right hand side under "Actions" click "Add...", fill out the window using status code 403.6 and choose your action.

这也可以通过修改网站的web.config文件来实现,只需将<error>条目添加到<httpErrors>部分,如下所示:

This can also be achieved by modifying your websites web.config file, just add an <error> entry to the <httpErrors> section as shown below:

<system.webServer>
    <httpErrors>
        <error statusCode="403" subStatusCode="6" path="/errors/iprestricted.html" responseMode="ExecuteURL" />
    </httpErrors>
</system.webServer>

这篇关于IP限制错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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