3
Answers

Disabling Client Side (browser) caching & impact on AJAX

Photo of Gary King

Gary King

13y
2.6k
1
Hi,

So I guess that I have 2 questions....

1. I have been asked whether client side caching has been disabled in my asp.net webforms (which it hasn't) - what is the best way of going about this?

2. Some of my webforms use AJAX - would disabling caching have any impact on AJAX?

I am using .net framework 2.


Many Thanks
Gary

Answers (3)

0
Photo of Gohil Jayendrasinh
NA 5k 2.8m 13y
if you want to store some information in  memorry then use caching.
http://weblogs.asp.net/mikaelsoderstrom/archive/2010/07/06/use-caching-in-asp-net-web-pages.aspx
0
Photo of Gary King
NA 83 159.3k 13y
Thanks for the response Lion, but I am still very unsure about caching....

The webforms contain confidential financial information and I have been asked to ensure that no data is cached on the users' browser. So I guess that I need to completely disable caching, but I am not sure of....

1. How to ensure there is no caching

2. If there is no caching, then would this affect the webform performance and/or functionality? (We dont use jQuery AJAX)
0
Photo of Gohil Jayendrasinh
NA 5k 2.8m 13y
For Page lavel caching
1.
<%@ OutputCache Duration="60" VaryByParam="None" %>

in web config

<outputCacheSettings>
  <outputCacheProfiles>
    <add name="CacheProfile1" duration="60" />
  </outputCacheProfiles>
</outputCacheSettings>

this will help you
http://msdn.microsoft.com/en-us/library/06bh14hk(v=vs.71).aspx
http://msdn.microsoft.com/en-us/library/ms178606.aspx

2.

if you use jQuery ajax
than
$.ajax({
  url: "test.html",
  context: document.body,
  cache:false, //it will force requested pages not to be cached by the browser.
  success: function(){
    $(this).addClass("done");
  }
});