Hi,
status code - 500 internal server error this time header not showing.
we have implemented logic in web.config and code level in asp.net c#.
· X-Frame Option: Deny.
· X-XSS Protection: 1; mode=block,
· X-Content Type-Options: Nosniff,
· Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
· Content-Security-Policy: script-src 'self'; default-src ‘self’; object-src 'none'
· Referrer-Policy: strict-origin-when-cross-origin
· Cache-Control: no-store, no-cache, must-revalidate
kindly help me.
Cynthia SathuragiriPosted Jun 8, 2026, 4:52 AM
A 500 Internal Server Error usually indicates that the request is failing before the response is completed. In such cases, the security headers may not be added to the response if the error occurs before the header injection logic executes.
Please check the following:
Verify whether the 500 error is generated by IIS or by the ASP.NET application.
Ensure the security headers are added in a global location such as
Application_EndRequestor via IIS custom headers, so they are applied to all responses.Review the IIS
and ASP.NETconfiguration, as custom error pages can sometimes override or remove headers.Check the IIS logs and application logs for the root cause of the 500 error.
Use the browser's Network tab, Fiddler, or Postman to inspect the actual response headers returned during the error scenario.
Please share the relevant
web.configsettings and the ASP.NET code used to add the headers so that the issue can be analyzed further.