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:
parent
003d06604e
commit
28e6c34748
@ -75,26 +75,30 @@ namespace Teknik.Controllers
|
|||||||
// Get the Favicon
|
// Get the Favicon
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[OutputCache(
|
|
||||||
Duration = 31536000,
|
|
||||||
Location = OutputCacheLocation.ServerAndClient)]
|
|
||||||
public ActionResult Favicon()
|
public ActionResult Favicon()
|
||||||
{
|
{
|
||||||
// Get favicon
|
// Get favicon
|
||||||
string imageFile = Server.MapPath(Constants.FAVICON_PATH);
|
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");
|
return File(imageFile, "image/x-icon");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the Logo
|
// Get the Logo
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[OutputCache(
|
|
||||||
Duration = 31536000,
|
|
||||||
Location = OutputCacheLocation.ServerAndClient)]
|
|
||||||
public ActionResult Logo()
|
public ActionResult Logo()
|
||||||
{
|
{
|
||||||
// Get favicon
|
// Get favicon
|
||||||
string imageFile = Server.MapPath(Constants.LOGO_PATH);
|
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");
|
return File(imageFile, "image/svg+xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@ namespace Teknik
|
|||||||
|
|
||||||
AntiForgeryConfig.RequireSsl = true;
|
AntiForgeryConfig.RequireSsl = true;
|
||||||
|
|
||||||
|
MvcHandler.DisableMvcResponseHeader = true;
|
||||||
|
|
||||||
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
||||||
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
||||||
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
||||||
@ -45,6 +47,12 @@ namespace Teknik
|
|||||||
stopwatch.Start();
|
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)
|
protected void Application_EndRequest(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
<forms domain=".teknik.io" protection="All" enableCrossAppRedirects="true" name="TeknikAuth" />
|
<forms domain=".teknik.io" protection="All" enableCrossAppRedirects="true" name="TeknikAuth" />
|
||||||
</authentication>
|
</authentication>
|
||||||
<compilation debug="true" targetFramework="4.6.2" />
|
<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" />
|
<pages buffer="true" enableViewState="false" />
|
||||||
</system.web>
|
</system.web>
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
|
Loading…
Reference in New Issue
Block a user