1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Removed unecessary headers.

Added cache headers for favicon and logo
This commit is contained in:
Uncled1023 2018-01-27 22:25:30 -08:00
parent 003d06604e
commit 28e6c34748
3 changed files with 19 additions and 7 deletions

View File

@ -75,26 +75,30 @@ namespace Teknik.Controllers
// Get the Favicon
[HttpGet]
[AllowAnonymous]
[OutputCache(
Duration = 31536000,
Location = OutputCacheLocation.ServerAndClient)]
public ActionResult Favicon()
{
// Get favicon
string imageFile = Server.MapPath(Constants.FAVICON_PATH);
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetMaxAge(new TimeSpan(365, 0, 0, 0));
Response.Cache.SetLastModified(System.IO.File.GetLastWriteTime(imageFile));
return File(imageFile, "image/x-icon");
}
// Get the Logo
[HttpGet]
[AllowAnonymous]
[OutputCache(
Duration = 31536000,
Location = OutputCacheLocation.ServerAndClient)]
public ActionResult Logo()
{
// Get favicon
string imageFile = Server.MapPath(Constants.LOGO_PATH);
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetMaxAge(new TimeSpan(365, 0, 0, 0));
Response.Cache.SetLastModified(System.IO.File.GetLastWriteTime(imageFile));
return File(imageFile, "image/svg+xml");
}

View File

@ -32,6 +32,8 @@ namespace Teknik
AntiForgeryConfig.RequireSsl = true;
MvcHandler.DisableMvcResponseHeader = true;
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
@ -45,6 +47,12 @@ namespace Teknik
stopwatch.Start();
}
protected void Application_PreSendRequestHeaders(object sender, EventArgs e)
{
// Remove stupid headers
HttpContext.Current.Response.Headers.Remove("Server");
}
protected void Application_EndRequest(object sender, EventArgs e)
{
try

View File

@ -47,7 +47,7 @@
<forms domain=".teknik.io" protection="All" enableCrossAppRedirects="true" name="TeknikAuth" />
</authentication>
<compilation debug="true" targetFramework="4.6.2" />
<httpRuntime targetFramework="4.6.2" maxRequestLength="5242880" executionTimeout="3600" relaxedUrlToFileSystemMapping="true" />
<httpRuntime targetFramework="4.6.2" maxRequestLength="5242880" executionTimeout="3600" relaxedUrlToFileSystemMapping="true" enableVersionHeader="false" />
<pages buffer="true" enableViewState="false" />
</system.web>
<system.webServer>