我创建了一个MVC3应用程序,并在web.config中添加了 上的cutomerrors属性。它适用于chrome和Firefox但是当我在IE9中运行时,我得到了
网站无法显示页面
HTTP 500
最有可能的原因: •网站正在维护中。 •网站出现编程错误。
你可以尝试:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<appSettings>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<system.web>
<customErrors mode="On"></customErrors>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages"/>
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
答案 0 :(得分:3)
Internet Explorer版本中存在一个已知问题,其中自定义错误页面必须至少为512个字节。虽然这通常适用于旧的IE版本,并且通常会导致404错误页面,但我建议您确保自定义错误页面的大小为1 kB。您可以在其中添加一些HTML注释。只是为了确保它与旧的IE漏洞无关。
只有一个参考: http://perishablepress.com/press/2008/01/21/important-note-for-your-custom-error-pages/
答案 1 :(得分:0)
这是内置的IE错误页面。你可以发布你的web.config所以我们可以看到你在那里有什么?
<customErrors mode="On" defaultRedirect="/Home/Error">
<error statusCode="403" redirect="/Home/NoAccess" />
<error statusCode="404" redirect="/Home/NotFound" />
<error statusCode="500" redirect="/Home/Internal" />
</customErrors>
我希望在网络配置中看到什么。我不确定在其他浏览器中显示的是哪个页面。
我猜IE9希望返回一些内容,尝试将内部操作和视图添加到您的家庭控制器并指定defaultRedirect =“/ Home / Internal”,看看是否有效。