cs11dotnet7/vscode/PracticalApps/Northwind.WebApi/SecurityHeadersMiddleware.cs
2022-03-13 16:17:01 +00:00

21 lines
425 B
C#

using Microsoft.Extensions.Primitives; // StringValues
public class SecurityHeaders
{
private readonly RequestDelegate next;
public SecurityHeaders(RequestDelegate next)
{
this.next = next;
}
public Task Invoke(HttpContext context)
{
// add any HTTP response headers you want here
context.Response.Headers.Add(
"super-secure", new StringValues("enable"));
return next(context);
}
}