如何在IIS7中伪造404

发布于 2024-09-03 17:58:55 字数 117 浏览 3 评论 0原文

我想将 /directory/default.aspx 设置为返回 404,即使文件和文件夹存在。在 IIS7 设置中如何做到这一点?

更新:我想在 IIS 管理器中执行此操作,而不是在代码上执行此操作。

I would like to set /directory/default.aspx to return 404 even though file and folder exist. How is this possible to do in IIS7 settings?

Update: I would like to do this in IIS Manager, not on code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

本宫微胖 2024-09-10 17:58:55

据我所知,没有用于此目的的 IIS 设置。

As far as I know, there is no IIS setting for this purpose.

木森分化 2024-09-10 17:58:55

您可以尝试在 default.aspx 中抛出异常:

throw new HttpException (404, "");

You can try throwing an exception inside of your default.aspx:

throw new HttpException (404, "");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文