ASP.net web.config中没有捕捉到所有404的 [英] ASP.net web.config doesn't catch all 404's

查看:198
本文介绍了ASP.net web.config中没有捕捉到所有404的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的web.config我有:

In my web.config I have:

    <customErrors mode="On" defaultRedirect="~/Error.aspx" redirectMode="ResponseRewrite">
        <error statusCode="500" redirect="~/Error.aspx" />
        <error statusCode="404" redirect="~/404.aspx" />
    </customErrors>

然而,随着这些URL的,只有二日一文件扩展定义的作品,另外一个返回蓝屏404中的服务器错误应用程序。

Yet with these URL's, only the 2nd one with file extension defined works, the other one returns the blue screen 404 "Server Error in Application".

http://127.0.0.1/scirranew/invalidpath

http://127.0.0.1/scirranew/invalidpath.aspx

任何想法?我在ASP.net 4,IIS 7.5。

Any ideas? I'm on ASP.net 4, IIS 7.5.

推荐答案

如果你想要这个工作,你需要配置IIS传递到.NET发动机的所有请求。你的第一个例子是不明显要求一个.NET的页面,所以它不是路由到.NET引擎。

If you want this to work, you need to configure IIS to pass all requests to the .NET engine. Your first example is not obviously asking for a .NET page, so it is not routed to the .NET engine.

什么版本的IIS和.NET您使用的是? 这可能帮助。

What version of IIS and .NET are you using? This may help.

这篇关于ASP.net web.config中没有捕捉到所有404的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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