Disabling caching in Web.Config for the entire Asp .Net Application

Last post 05-30-2008 1:03 PM by mreynol5. 7 replies.

Sort Posts:

  • Disabling caching in Web.Config for the entire Asp .Net Application

    05-30-2008, 6:00 AM
    • Member
      177 point Member
    • abrahamsibu
    • Member since 05-27-2008, 8:05 PM
    • Posts 31

     

    How to disabe caching in Web.Config for the entire Asp .Net Application?

  • Re: Disabling caching in Web.Config for the entire Asp .Net Application

    05-30-2008, 7:22 AM

    Hi there,

    Have a look at this article, might be interest you.

    http://msdn.microsoft.com/en-us/library/ms178606(VS.80).aspx

    Hope it helps!

    DC517
    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved.
  • Re: Disabling caching in Web.Config for the entire Asp .Net Application

    05-30-2008, 7:32 AM
    • All-Star
      60,891 point All-Star
    • anas
    • Member since 09-21-2006, 8:31 AM
    • Palestinian Territory, Occupied
    • Posts 6,865
    • Moderator

    As far as i know, you can't disable the Cache for the entire application , if you don't want it , don't use it ! 

    but you can diable outputcaching and session state  for the etire application by removing its modules , this can be done from web.config

    <httpModules>
    <add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
    <add name="Session" type="System.Web.SessionState.SessionStateModule" />
    </httpModules>

     you can read more about performance optimization in this article,


     

    Regards,

    Anas Ghanem | Blog

  • Re: Disabling caching in Web.Config for the entire Asp .Net Application

    05-30-2008, 7:39 AM
    • Member
      177 point Member
    • abrahamsibu
    • Member since 05-27-2008, 8:05 PM
    • Posts 31

    These tags are not there in my config files.

    My actual problem is,

    I am calling a web page using window.open("a.aspx","_self"). The page a.aspx is displayed but with old data i.e. an old instance of page is displayed. Is there a way by which I can get a fresh page every time I request for that page.

  • Re: Disabling caching in Web.Config for the entire Asp .Net Application

    05-30-2008, 7:45 AM
    • All-Star
      60,891 point All-Star
    • anas
    • Member since 09-21-2006, 8:31 AM
    • Palestinian Territory, Occupied
    • Posts 6,865
    • Moderator

     Sure,

    add this to your page load

    Response.Cache.SetCacheability(HttpCacheability.NoCache)
     

    Regards,

    Anas Ghanem | Blog

  • Re: Disabling caching in Web.Config for the entire Asp .Net Application

    05-30-2008, 7:46 AM

    Hi There,

    You can add following code to a.aspx to instantly clear the cache of the page.

    <head runat="server">

    <title>WebForm</title>

    <link rel="shortcut icon" href="favicon.ico" type="image/ico" />

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

    <meta http-equiv="pragma" content="no-cache" />

    <meta http-equiv="expires" content="-1" />

    </head>

    Hope it helps!

    DC517
    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved.
  • Re: Disabling caching in Web.Config for the entire Asp .Net Application

    05-30-2008, 8:42 AM
    Answer
    • Member
      154 point Member
    • venkyzeal
    • Member since 12-31-2007, 1:41 PM
    • India
    • Posts 32

    abrahamsibu:

    These tags are not there in my config files.

    My actual problem is,

    I am calling a web page using window.open("a.aspx","_self"). The page a.aspx is displayed but with old data i.e. an old instance of page is displayed. Is there a way by which I can get a fresh page every time I request for that page.

    abrahamsibu,

    Since you are calling the page through window.open() but not doing a postback to the same original page that transfers you to the other page, the browser identifies the link as the one you already visited, searches your cache if the version of that page already existings or not. If yes, it simply displays the page. There are meta tags that you can specify inside the head tag that may inform the broswser not to use the cached version but may a fresh request.

    Use the following tags inside head tag of your page.

    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

    Both the above tags should be included if you are not sure if server is HTTP/1.1 compliant. Also Include:-

    <META HTTP-EQUIV="EXPIRES"
    CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">  tells the server which cache the page to expire the page in given time interval. An invalid interval like "0" or "-1" expires it immediately and causes a fetch of latest version of file, each time request is made.

    you can get complete info at this link :- http://www.i18nguy.com/markup/metatags.html

    Kindly mark it as answer if this solves your concerns.

     

    J. Venkatesh
    Syntel
  • Re: Disabling caching in Web.Config for the entire Asp .Net Application

    05-30-2008, 1:03 PM
    • Member
      61 point Member
    • mreynol5
    • Member since 05-19-2008, 5:21 PM
    • Posts 154

    Yes

    Mike Reynolds
    CrystalVoice, LLC
Page 1 of 1 (8 items)