Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Any possibility to avoid cache in asp.net

Any possibility to avoid cache in asp.net

Scheduled Pinned Locked Moved ASP.NET
csharpasp-net
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anushh
    wrote on last edited by
    #1

    Any possibility to avoid cache in asp.net

    C A 2 Replies Last reply
    0
    • A anushh

      Any possibility to avoid cache in asp.net

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You mean apart from turning it off ? Most people ask this because they've written bad security code, and need to fix it. Is that your problem ?

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      A 1 Reply Last reply
      0
      • A anushh

        Any possibility to avoid cache in asp.net

        A Offline
        A Offline
        Abhishek Sur
        wrote on last edited by
        #3

        You mean server cache or client cache ?? :confused:

        Abhishek Sur


        My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

        **Don't forget to click "Good Answer" if you like to.

        A 1 Reply Last reply
        0
        • C Christian Graus

          You mean apart from turning it off ? Most people ask this because they've written bad security code, and need to fix it. Is that your problem ?

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          A Offline
          A Offline
          anushh
          wrote on last edited by
          #4

          In my page While the landingpage was load, the videos are displayed. Then i move to another page name video.aspx and upload one new video.when i move to the landing page That currently inserted video is not reflected in the landing page. I think because of cache problem.Any solution?

          C N 2 Replies Last reply
          0
          • A Abhishek Sur

            You mean server cache or client cache ?? :confused:

            Abhishek Sur


            My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

            **Don't forget to click "Good Answer" if you like to.

            A Offline
            A Offline
            anushh
            wrote on last edited by
            #5

            client cache

            A 1 Reply Last reply
            0
            • A anushh

              In my page While the landingpage was load, the videos are displayed. Then i move to another page name video.aspx and upload one new video.when i move to the landing page That currently inserted video is not reflected in the landing page. I think because of cache problem.Any solution?

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Response.Cache.SetCacheability(HttpCacheability.NoCache)

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              1 Reply Last reply
              0
              • A anushh

                client cache

                A Offline
                A Offline
                Abhishek Sur
                wrote on last edited by
                #7

                Remove Output Cache for One Page

                HttpResponse.RemoveOutputCacheItem("/foldername/CacheForever.aspx");

                Add Key Dependency to Page

                Response.AddCacheItemDependency("clearcachekey");

                Means we placed a dependance on smallkey. Now place this in global.aspx

                protected void Application_Start(Object sender, EventArgs e)
                {
                HttpContext.Current.Cache.Insert("clearcachekey", DateTime.Now, null,
                System.DateTime.MaxValue, System.TimeSpan.Zero,
                System.Web.Caching.CacheItemPriority.NotRemovable,
                null);
                }

                or add this in pageload on which you want to remove cache :

                HttpContext.Current.Cache.Insert("clearcachekey", DateTime.Now, null,
                System.DateTime.MaxValue, System.TimeSpan.Zero,
                System.Web.Caching.CacheItemPriority.NotRemovable,
                null);

                :thumbsup:

                Abhishek Sur


                My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

                **Don't forget to click "Good Answer" if you like to.

                1 Reply Last reply
                0
                • A anushh

                  In my page While the landingpage was load, the videos are displayed. Then i move to another page name video.aspx and upload one new video.when i move to the landing page That currently inserted video is not reflected in the landing page. I think because of cache problem.Any solution?

                  N Offline
                  N Offline
                  N a v a n e e t h
                  wrote on last edited by
                  #8

                  anushh wrote:

                  That currently inserted video is not reflected in the landing page. I think because of cache problem.

                  Yes it is because of caching. Browsers cache content depending on the URL. So when video is uploaded, change the URL of the video so that browser will load the latest content. To do this, add a dummy time stamp to the video link. Something like video.aspx?videoid=10&timestamp=somerandomvalue since the random value will be different each time, browser will be forced to load a latest version for each request. :)

                  Navaneeth How to use google | Ask smart questions

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups