IIS7 Hijacks My Coldfusion Error Page

孤人 提交于 2019-12-04 03:15:40

问题


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.

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.

How can someone in Coldfusion do it / how can I just tell IIS to stop its thinks it knows better than me shenanigans.


回答1:


This might help:

<configuration>
  <system.webServer>
    <httpErrors existingResponse="PassThrough" />
  </system.webServer>
</configuration>

For more information:

HTTP Errors (IIS.NET)
What to expect from IIS7 custom error module (IIS.NET)

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'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.

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);


来源:https://stackoverflow.com/questions/3936722/iis7-hijacks-my-coldfusion-error-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!