- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个在 IIS 6.0 上运行的 ASP.NET 4.0 MVC Web 应用程序,其 webconfig 自定义错误部分为:
<customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="/Home/Error">
<error statusCode="403" redirect="/Home/Error"/>
<error statusCode="404" redirect="/Home/Error"/>
</customErrors>
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<System.Web.Mvc.HandleErrorInfo>" %>
<%@ Import Namespace="System.Security.Cryptography" %>
<%@ Import Namespace="System.Threading" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Error
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Error Processing your request.</h2>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Scripts" runat="server">
<script runat="server">
void Page_Load() {
byte[] delay = new byte[1];
RandomNumberGenerator prng = new RNGCryptoServiceProvider();
prng.GetBytes(delay);
Thread.Sleep((int)delay[0]);
IDisposable disposable = prng as IDisposable;
if (disposable != null) { disposable.Dispose(); }
}
</script>
</asp:Content>
最佳答案
不幸的是,您不能拥有任何 <error>
<customErrors>
中的标签根据 Scott Guthrie 的说法,阻止。他们肯定正在开发补丁,但与此同时,您必须使用一个非常简单的 <customErrors>
部分如下:
<customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="~/error.aspx" />
关于security - MVC - CustomErrors 在设置 redirectMode =“ResponseRewrite” 时不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3779581/
我看到类似的问题,但似乎是由于一个不相关的问题。 在3.5中,我有一个自定义错误处理程序,用于记录错误并重定向用户。我的web.config设置如下:
我正在尝试为我的网站(ASP.NET 4,集成管道)设置自定义错误页面。 在本地计算机上一切正常,但 .aspx 页面的自定义错误页面不会显示在共享主机上(我看到默认错误页面)。 如果我将 redir
我正在使用 web.config 中的自定义错误属性来处理自定义错误 像这样: 抛出错误后,页面被重定向到错误页面,但是当我访问错误页面中的session时,它是null。 我使用 Response
在旧站点中,我通过添加 redirectMode="ResponseRewrite" 来更改 CustomErrors 的工作方式(3.5 SP1 中的新增功能): 问题是:它向我显示了
我有一个在 IIS 6.0 上运行的 ASP.NET 4.0 MVC Web 应用程序,其 webconfig 自定义错误部分为: 和一个如下所示的 error.aspx 页面: "
按照建议elsewhere ,我在自定义错误配置中使用redirectMode = ResponseRewrite,以便我的自定义错误页面可以访问异常信息。一段时间以来,这就像一种魅力。 在添加更多“
我是一名优秀的程序员,十分优秀!