Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 以编程方式删除回发时的浏览器缓存_C#_Javascript_Jquery_Asp.net_Caching - Fatal编程技术网

C# 以编程方式删除回发时的浏览器缓存

C# 以编程方式删除回发时的浏览器缓存,c#,javascript,jquery,asp.net,caching,C#,Javascript,Jquery,Asp.net,Caching,是否仍然可以通过编程方式在回发时删除浏览器缓存?我正在使用一个jquery函数,该函数在单击按钮时使用ajax,并使用cache:true function CallSyncAjax(url, args, resid, EnableCache, ErrorDivID) { $.ajax({ type: "GET", url: url, data: args, cache: EnableCache, success: function (data) {

是否仍然可以通过编程方式在回发时删除浏览器缓存?我正在使用一个jquery函数,该函数在单击按钮时使用ajax,并使用
cache:true

function CallSyncAjax(url, args, resid, EnableCache, ErrorDivID) {
$.ajax({
    type: "GET",
    url: url,
    data: args,
    cache: EnableCache,
    success: function (data) {
        var StrResponse;
        StrResponse = data.split('@@@');
        if (resid == "1001") {
            LoginByAccountRes(StrResponse[0]);
        }
    }
   })
 }
C#:


问题是,每当我在一分钟后刷新页面时,甚至当我关闭浏览器并重新打开它时,缓存仍然存在

由于浏览器的安全原因,您无法通过代码清除浏览器的历史记录,您只能设置HTTP头,告诉浏览器不要更改页面,使用以下方法:


缓存控制:无缓存

JavaScript只允许在浏览器上执行某些操作,访问浏览器的缓存不是其中之一

但是,您可以使用
meta
标记控制网页的缓存

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />

您可以在页面上使用这些表示不缓存的元标记

<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>


但由于浏览器的安全原因,您无法以编程方式清除浏览器缓存。

为什么不尝试
DateTime dt=DateTime.Now.AddMinutes(-1)?尝试
Response.Cache.SetCacheability(HttpCacheability.NoCache)因为它不起作用
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>