如何清除缓存后,我完成了保存数据

本文关键字:数据 保存 何清除 清除 缓存 | 更新日期: 2023-09-27 17:50:16

我只是新的asp.net,我想知道我如何才能清除保存后的所有数据项,并重定向到其他页面?

我已经在我的HTML页面上尝试过了,

<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">

还有我的Code Behind页面

    protected void Page_Load(object sender, System.EventArgs e)
    {
        if(!Page.IsPostBack)
        {
            Response.Cache.SetCacheability(HttpCacheability.Server);
            Response.Expires = -1;
            Response.AddHeader("Pragma", "No-Cache");
            Response.CacheControl = "no-cache";
        }
    }

,但仍然数据我编码/页面出现每当我回去。

请帮助。非常感谢。谢谢你!: D

如何清除缓存后,我完成了保存数据

应该是:

Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();

如果你不想让浏览器一直填充表单字段,你可以将HTML属性autocomplete设置为off

<input type="text" name="myfield" autocomplete="off" />