IIS7劫持我的Coldfusion错误页面 [英] IIS7 Hijacks My Coldfusion Error Page
问题描述
在我的异常处理文件中,我将状态码设置为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停止它的认为它比我知道更好的shenanigans。
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>
有关详情:
如果这不起作用,那么你可能会尝试编写一个.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错误页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!