Internet Explorer中的缓存问题 [英] Cache issue in internet explorer

查看:80
本文介绍了Internet Explorer中的缓存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我面临一个问题,当我在UAT服务器中部署我的代码更改(Asp.net,c#)时。每个.aspx文件都使用最新版本的javascript文件并且它可以正常工作但是当我在生产服务器中部署我的代码时,.aspx有时会采用缓存版本的javascript文件,这会导致最终用户没有看到新的更改。





有些最终用户没有关闭他们的桌面,因此他们面临这个问题。



无论何时用户访问任何页面(第一次/第二次),页面都应该使用最新版本的javascript。



我在Internet Explorer 11.0中遇到此问题。

在Internet Explorer中,Temperort Internet文件的一般设置即

检查更新版本的缓存版本,每次我访问不可行的网页,因为网站被许多用户使用。





如果您有任何其他解决方案,请告诉我。

谢谢



我尝试过:



1.

< script src =Javascript./Myjavascript.js?session =+ SessionID type =text / javascript>< / script>



in aspx file < br $>


2.

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.Cache.SetExpires( DateTime.Now);

Response.Cache.SetNoServerCaching();

Response.Cache.SetNoStore();





我尝试了两个解决方案,但仍然是最终用户面部缓存问题。

Hi All,

I am facing one issue , When I deploy my code changes (Asp.net,c#) in UAT server. Every .aspx file takes the latest version of javascript file and it works correctly but when I deploy my code in production server then .aspx sometimes take cached version of javascript file which cause no new changes is seen to end user.


Some end user doesn't shutdown their desktop so they face the issue.

I want whenever user visit any page (first time /second time), page should take the latest version of javascript.

I am facing this issue in Internet Explorer 11.0.
In Internet Explorer, general setting of Temperort internet files i.e.
Check for newer version of cache version,Everytime I visit webpage that is not feasible because website is used by many users.


If you have any other solution please let me know.
Thanks

What I have tried:

1.
<script src="Javascript./Myjavascript.js?session="+SessionID type="text/javascript"></script>

in aspx file

2.
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now);
Response.Cache.SetNoServerCaching();
Response.Cache.SetNoStore();


I tried above two solution but still end user face cache issue.

推荐答案

<script src="Javascript./Myjavascript.js?session="+SessionID type="text/javascript"></script>





假设SessionID是asp.net会话ID,你就在正确的轨道上但是有一个你的实施问题。如果您在某人会话中更新js文件,那么他们的ID不会更改,因此他们看不到新版本,会话ID也会被重新使用,因此他们可以保持会话ID比您想象的更长。



而不是使用会话ID只需使用每次发布时增加的简单版本号





Assuming SessionID is the asp.net session ID, you are on the right tracks but there is a problem with your implementation. If you update the js file in the middle of someone's session then their id does not change so they don't see the new version, also session IDs get re-used so they can keep their session id longer than you might think they do.

Rather than use the session id just use a simply version number that you increment each time you release

<script src="Javascript./Myjavascript.js?ver=1" type="text/javascript"></script>





下次更新js文件时,将其更改为ver = 2,依此类推。



The next time you update the js file change it to ver=2 and so on.


我认为没有一个完美的答案。我们在一些地方使用JavaScript
I do not think there is a perfect answer. We have some places where we tack on JavaScript
new Date().getTime()

到最后或我们的网址,以便IE认为它是一个以前没有被查看的页面,但我们仍然有缓存问题。它通常有效但不是所有时间。



最好的选择是提醒用户清除缓存。

to the end or our urls so that IE will think it is a page that has not been viewed before but we still have cache issues. It usually works but not all the time.

The best option is to remind your users to clear their cache.


这篇关于Internet Explorer中的缓存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆