问题描述
在我的异常处理文件中,我将状态码设置为 404,然后为错误页面呈现 n 个 HTML 页面(想想失败鲸鱼).
In my exception handling file, I set a statuscode to 404 and then render n HTML page, for the error page (think fail-whale).
<cfheader statuscode="404" statustext="Application Exception">
<html><head><title>Error</title></head><body><h1>There was an error yo!</h1></body></html>
这显然过于简化了,但只是为了确保一切都得到了演示.
This is obviously over simplified, but just to make sure everything was demonstrated.
我发现,从 ASP.NET 请求中,他们可以设置一个变量Response.TrySkipIisCustomErrors=true",以防止 IIS 显示自己的错误页面.
What I have found is that from a ASP.NET request, they can set a variable "Response.TrySkipIisCustomErrors=true" to keep IIS from showing its own error page.
Coldfusion 中的某个人怎么能做到这一点/我怎么能告诉 IIS 停止它认为它比我更了解的恶作剧.
How can someone in Coldfusion do it / how can I just tell IIS to stop its thinks it knows better than me shenanigans.
推荐答案
这可能会有所帮助:
<configuration>
<system.webServer>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</configuration>
更多信息:
HTTP 错误 (IIS.NET)
什么期望从 IIS7 自定义错误模块 (IIS.NET)
如果这不起作用,那么您可以尝试编写一个 .NET HttpModule
以插入 IIS 请求/响应管道以设置 Response.TrySkipCustomErrors
.不理想.
If that doesn't work then you might try writing a .NET HttpModule
to plug into the IIS request/response pipeline to set Response.TrySkipCustomErrors
. Not ideal.
ASP.NET 的工作请求对象调用一个名为 MgdSetStatusW
的导出函数.这里的问题是,除非 Coldfusion 公开此标志,否则您将无法直接在 CF 中设置该值.
ASP.NET's worker request object calls an exported function called MgdSetStatusW
. The problem here is that unless Coldfusion exposes this flag then you won't be able to set the value directly in CF.
使用 .NET Reflector 我看到 ASP.NET 使用以下方法设置响应状态:
Poking around with .NET Reflector I seen ASP.NET setting the response status using:
[DllImport("webengine4.dll", CharSet=CharSet.Unicode)]
internal static extern int MgdSetStatusW(IntPtr pRequestContext,
int dwStatusCode, int dwSubStatusCode, string pszReason,
string pszErrorDescription, bool fTrySkipCustomErrors);
这篇关于IIS7 劫持了我的 Coldfusion 错误页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!