Split VAR.WebForms.Common to a class library.

This commit is contained in:
2020-03-01 11:54:12 +01:00
parent df927722ba
commit e414663d12
37 changed files with 333 additions and 116 deletions

View File

@@ -0,0 +1,27 @@
using System;
using System.Web;
namespace VAR.WebForms.Common
{
public class GlobalModule : IHttpModule
{
public void Dispose() { }
public void Init(HttpApplication context)
{
context.PreSendRequestHeaders += Context_PreSendRequestHeaders;
}
private void Context_PreSendRequestHeaders(object sender, EventArgs e)
{
HttpContext ctx = HttpContext.Current;
if (ctx == null) { return; }
ctx.Response.Headers.Remove("Server");
ctx.Response.Headers.Remove("X-Powered-By");
ctx.Response.Headers.Add("X-Content-Type-Options", "nosniff");
ctx.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN");
ctx.Response.Headers.Add("X-XSS-Protection", "1; mode=block");
}
}
}