Add no-cache header to error pages (#182)

Addresses #123
This commit is contained in:
Jass Bagga 2017-12-07 12:11:44 -08:00 committed by GitHub
parent aba10e768b
commit 88e05f71a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,7 @@ namespace AureliaSpa.Controllers
return View(); return View();
} }
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error() public IActionResult Error()
{ {
ViewData["RequestId"] = Activity.Current?.Id ?? HttpContext.TraceIdentifier; ViewData["RequestId"] = Activity.Current?.Id ?? HttpContext.TraceIdentifier;

View File

@ -14,6 +14,7 @@ namespace KnockoutSpa.Controllers
return View(); return View();
} }
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error() public IActionResult Error()
{ {
ViewData["RequestId"] = Activity.Current?.Id ?? HttpContext.TraceIdentifier; ViewData["RequestId"] = Activity.Current?.Id ?? HttpContext.TraceIdentifier;

View File

@ -14,6 +14,7 @@ namespace VueSpa.Controllers
return View(); return View();
} }
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error() public IActionResult Error()
{ {
ViewData["RequestId"] = Activity.Current?.Id ?? HttpContext.TraceIdentifier; ViewData["RequestId"] = Activity.Current?.Id ?? HttpContext.TraceIdentifier;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Company.WebApplication1.Pages namespace Company.WebApplication1.Pages
@ -13,6 +14,7 @@ namespace Company.WebApplication1.Pages
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public void OnGet() public void OnGet()
{ {
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;

View File

@ -38,6 +38,7 @@ namespace Company.WebApplication1.Controllers
#if (OrganizationalAuth) #if (OrganizationalAuth)
[AllowAnonymous] [AllowAnonymous]
#endif #endif
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error() public IActionResult Error()
{ {
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });