Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Caching not stopping on IE

Posted on 2014-03-04
12
Medium Priority
?
139 Views
Last Modified: 2014-03-10
Basically I have asp.net Page,Where I am trying to Stop Caching in my page,I tried following code:
Response.Cache.SetNoServerCaching()
                Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache)
                Response.Cache.SetNoStore()
                Response.Cache.SetExpires(New DateTime(1900, 1, 1, 0, 0, 0, 0))
                Response.Cookies.Clear()

and my IE browser setting is
Internet Option->Browser history Section->Setting
Then Check for New version for Stored Page section->Never

Still above code is not working.Please tell me how I can fix my issue.I don't get new version until I refresh page.Please reply asap.
0
Comment
Question by:Sudhanshum
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39905580
That is exactly the way it works.  Nothing on the server can 'break' the cache in the browser.  Your code can only request that it not be cached the next time you either force a pages request / refresh OR it expires from the browser cache.  Basically your code has no effect until it is fetched from the server.

Then Check for New version for Stored Page section->Never
I don't know why you would ever do that.  That tells your browser to Never expire content in it's cache.
0
 

Author Comment

by:Sudhanshum
ID: 39905594
Basically for testing Caching feature,I enabled caching that way in browser and then I wrote code to see if my code stop caching. Can u plz tell me How I can enable caching on IE and then can see if my code stop caching on IE. We are doing this for Live website testing so if any user browser has caching enabled then also it will not cache our website pages.
please reply asap.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39905641
Nothing on the server can remove pages from the browser cache until the pages expire (in the browser cache) or the user does a refresh.  While you can send the appropriate headers to tell the browser not to cache your page, it is actually just a 'request' not a command though it usually does work.  The user can set the browser's cache to what they want.  Just like you did.
0
Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

 

Author Comment

by:Sudhanshum
ID: 39905661
Thanks for reply,But I am not looking to remove existing cached items.What I want is if I deleted my browser history and cache,Then after that I don't want my website pages will ever be cached because of code I will use to stop caching.Means if any user browser has enabled caching still my webpage will not be cached.So means after all history deletion,I don't want to maintain cache of my website pages and this i want to do from coding.
Please reply asap.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39905717
I believe your code is fine... but the browser settings can 'override' your code.  And the browser settings are Not your choice.  In addition you picked the worst possible setting, 'Never'.  'Never' checking means Always fetching from cache.

IE is normally set to 'Automatic' and that is probably the setting you should test.  You can not make the browser users choose a different setting.  That is under their control.
0
 

Author Comment

by:Sudhanshum
ID: 39905778
Thanks for reply But Please tell me that How I will test caching on IE,means How I will check that previously caching was making then I will put my code and that way caching will stop. How I will do this type of setting and testing? Please reply asap.
0
 

Author Comment

by:Sudhanshum
ID: 39906165
Please reply me asap.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39906985
Sorry, I quit and went to bed.  The page that you are loading must have something that changes every time for you to check whether caching is occurring.  A common item is to put the current date and time at the top of the page.
0
 

Author Comment

by:Sudhanshum
ID: 39908948
Thanks for reply But What setting I need to do on browser for enabling caching,right now I am testing with one image on page then I m changing image with same name to check caching. but question is how to enable caching on IE? Please reply asap.
0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 1500 total points
ID: 39910025
You need to set the "Check for New Pages.." to 'Automatically'.
right now I am testing with one image on page then I m changing image with same name to check caching
That runs into the second problem with trying to control caching.  Setting the cache control headers for the main file has no direct effect on other files loaded by the main file such as images, CSS, and javascript.  They are cached separately.

Caching updates are determined by the "Last Modified" date of the file.  The content itself is Not checked.  So if you get the browser to get the most current copy of the main page, the best thing to do if you change images is to change the image link to a New file name.  Using the same old file name with a different image will cause the browser to wait until it expires from the browser cache before it gets a new copy.  That is true with CSS and javascript files also.
0
 

Author Closing Comment

by:Sudhanshum
ID: 39916846
Thanks a lot,I will try
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39916867
You're welcome, glad to help.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
While opting for any web-to-print solution, you need to discuss with your team and some of your end users and know their opinions about your decisions. In this article we list down some questions you need to ask yourself.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question