Better handling of static files.

This commit is contained in:
2018-03-17 19:54:58 +01:00
parent 3bacdae77e
commit 954c34b6e0
7 changed files with 109 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
using System.Web;
using System;
using System.Web;
using VAR.Json;
namespace VAR.Focus.Web.Code
@@ -27,6 +28,15 @@ namespace VAR.Focus.Web.Code
context.Response.Write(strObject);
}
public static void PrepareCacheableResponse(this HttpResponse response)
{
const int secondsInDay = 86400;
response.ExpiresAbsolute = DateTime.Now.AddSeconds(secondsInDay);
response.Expires = secondsInDay;
response.Cache.SetCacheability(HttpCacheability.Public);
response.Cache.SetMaxAge(new TimeSpan(0, 0, secondsInDay));
}
#endregion HttpContext
}
}