Walter.Web.FireWall
NoCacheAttribute Class
Members  Example 
Walter.Web.FireWall Assembly > Walter.Web.FireWall.Annotations Namespace : NoCacheAttribute Class
Tells the razor engine to include not cash the response in any form or way guarantying that the action is re-executed
Syntax
Remarks
Sometimes it's helpful to ensure a action is not cashed especially if the action generates user JavaScript that is dependent on the page.
Example
The bellow example injects the pageId and userSalt in a virtual java script file that will always re-load when a page is requested. this allows you to avoid the need to pass parameters to trick cashing in the browser.
public class HomeController : Controller
{       
    private readonly IPageRequest _page;
            
    public DocumentationController( IPageRequest page)
    {
        _page = page;      
    }
            
    [Route("js/Variables.js")]
    [NoCash]
    [Ignore(skip: FireWallGuardActions.EmbeddedResources)]
    public FileResult Script()
    {
        var sb = new StringBuilder();
        sb.AppendLine($"var userSalt ='{_page.User.GetUserSalt()}';");
        sb.AppendLine($"var pageId = {_page.PageRequestGroupId};");
            
        byte[] java = System.Text.Encoding.UTF8.GetBytes(sb.ToString());
        return File(java, "application/javascript");
    }
}
Inheritance Hierarchy

System.Object
   System.Attribute
      Microsoft.AspNetCore.Mvc.Filters.ActionFilterAttribute
         Walter.Web.FireWall.Annotations.NoCacheAttribute

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

NoCacheAttribute Members
Walter.Web.FireWall.Annotations Namespace