在我的异常处理文件中,我将状态代码设置为 404,然后渲染 n 个 HTML 页面,作为错误页面(想想失败鲸鱼)。
<cfheader statuscode="404" statustext="Application Exception">
<html><head><title>Error</title></head><body><h1>There was an error yo!</h1></body></html>
这显然过于简化,但只是为了确保一切都得到了演示。
我发现,从 ASP.NET 请求中,他们可以设置变量“Response.TrySkipIisCustomErrors=true”以阻止 IIS 显示自己的错误页面。
Coldfusion 中的人如何才能做到这一点/我如何才能告诉 IIS 停止它认为它比我更了解的恶作剧。
这可能有帮助:
<configuration>
<system.webServer>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</configuration>
了解更多信息:
HTTP 错误 (IIS.NET)
IIS7 自定义错误模块 (IIS.NET) 的预期结果
如果这不起作用,那么你可以尝试编写 .NETHttpModule
插入 IIS 请求/响应管道以设置Response.TrySkipCustomErrors
。不理想。
ASP.NET 的辅助请求对象调用一个名为MgdSetStatusW
。这里的问题是,除非 Coldfusion 公开此标志,否则您将无法直接在 CF 中设置该值。
通过查看 .NET Reflector,我看到 ASP.NET 使用以下方式设置响应状态:
[DllImport("webengine4.dll", CharSet=CharSet.Unicode)]
internal static extern int MgdSetStatusW(IntPtr pRequestContext,
int dwStatusCode, int dwSubStatusCode, string pszReason,
string pszErrorDescription, bool fTrySkipCustomErrors);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)