后退按钮不请求asp.net mvc get方法

sub*_*amn 4 asp.net-mvc-2

我们正面临一个特定的问题,在点击后退按钮时,默认的get方法不会在asp.net mvc中被触发

任何特定解决方案

eiu*_*165 6

如果您只想在每次使用时从服务器获取一个特定操作

[OutputCache(NoStore = true, Duration = 1)]
Run Code Online (Sandbox Code Playgroud)

作为你的行动的一个属性,像这样

    [HttpGet]
    [OutputCache(NoStore = true, Duration = 1)]
    public ActionResult Index()
    {
        ........
    }
Run Code Online (Sandbox Code Playgroud)


小智 5

如果浏览器缓存了页面,它将使用缓存中的页面.

尝试告诉响应不要缓存.您可以使用ActionFilter或Global.asax中的全局操作.

    httpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
    httpContext.Response.Cache.SetValidUntilExpires(false);
    httpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
    httpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    httpContext.Response.Cache.SetNoStore();
Run Code Online (Sandbox Code Playgroud)

更多选择:

禁用整个ASP.NET网站的浏览器缓存