Monday, December 8, 2025

Adding to the headers in .NET 10

To add to the Response Headers in .NET 10.  I am doing the following.  Specifically, I am setting the Content Security Policy (CSP).  Yeah, I'm doing bad stuff here, get over it.

var headers = context.Request.Headers;

headers.Append("Content-Security-Policy", "frame-src 'self' localhost; style-src 'self' 'unsafe-inline' https://kit.fontawesome.com https://cdn.jsdelivr.net https://code.jquery.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdnjs.cloudflare.com https://cdn.plot.ly https://cdn.jsdelivr.net https://kit.fontawesome.com  https://code.jquery.com");