IIS7 Hijacks My Coldfusion Error Page

前端 未结 1 1392
猫巷女王i
猫巷女王i 2021-01-18 01:14

In my exception handling file, I set a statuscode to 404 and then render n HTML page, for the error page (think fail-whale).



        
相关标签:
1条回答
  • 2021-01-18 01:44

    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);
    
    0 讨论(0)
提交回复
热议问题