public static IServiceCollection AddXContentTypeOptions(this IServiceCollection services, XContentTypeOptions policy = XContentTypeOptions.NoSniff) { return(services.AddSingleton <XContentTypeOptionsMiddleware>()); }
/// <summary> /// Adds the X-Content-Type-Options header to all responses. /// </summary> /// <param name="app"></param> /// <param name="policy"></param> public static void UseXContentTypeOptions(this IApplicationBuilder app, XContentTypeOptions policy = XContentTypeOptions.NoSniff) { app.UseMiddleware <XContentTypeOptionsMiddleware>(); }