#U4-2326 Added Try Catch for PlatformNotSupportedException

Signed-off-by: Sebastiaan Janssen <sebastiaan@umbraco.com>
This commit is contained in:
Murray@tbpc10.terabyte.co.nz
2013-06-06 00:48:19 +12:00
committed by Sebastiaan Janssen
parent f386c9d024
commit cf5624f377

View File

@@ -431,9 +431,16 @@ namespace Umbraco.Web
app.PreSendRequestHeaders += (sender, args) =>
{
var httpContext = ((HttpApplication)sender).Context;
httpContext.Response.Headers.Remove("Server");
//this doesn't normally work since IIS sets it but we'll keep it here anyways.
httpContext.Response.Headers.Remove("X-Powered-By");
try
{
httpContext.Response.Headers.Remove("Server");
//this doesn't normally work since IIS sets it but we'll keep it here anyways.
httpContext.Response.Headers.Remove("X-Powered-By");
}
catch (PlatformNotSupportedException ex)
{
// can't remove headers this way on IIS6 or cassini.
}
};
}