Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 817965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:04:32+00:00 2026-05-15T02:04:32+00:00

I am experiencing a problem with IE caching the results of an action method.

  • 0

I am experiencing a problem with IE caching the results of an action method.

Other articles I found were related to security and the [Authorize] attribute. This problem has nothing to do with security.

This is a very simple “record a vote, grab the average, return the avg and the number of votes” method. The only slightly interesting thing about it is that it is invoked via Ajax and returns a Json object. I believe that it is the Json object that is getting cached.

When I run it from FireFox and watch the XHR traffic with Firebug, everything works perfectly. However, under IE 8 the “throbber” graphic doesn’t ever have time to show up and the page elements that display the “new” avg and count that are being injected into the page with jQuery are never different.

I need a way to tell MVC to never cache this action method.

This article seems to address the problem, but I cannot understand it:
Prevent Caching of Attributes in ASP.NET MVC, force Attribute Execution every time an Action is Executed

I need a bit more context for the solution to understand how to extend AuthorizationAttribute. Please address your answer as if you were speaking to someone who lacks a deep understanding of MVC even if that means replying with an article on some basics/prerequisites that are required.

Thanks,

Trey Carroll

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:04:32+00:00Added an answer on May 15, 2026 at 2:04 am

    MVC doesn’t cache the results. IE does.

    So you have to tell IE not to do it.

    Here’s how I do it. First, an attribute:

    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
    public sealed class CacheControlAttribute : ActionFilterAttribute
    {
        public CacheControlAttribute(HttpCacheability cacheability)
        {
            this._cacheability = cacheability;
        }
    
        public HttpCacheability Cacheability { get { return this._cacheability; } } 
    
        private HttpCacheability _cacheability;
    
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            HttpCachePolicyBase cache = filterContext.HttpContext.Response.Cache;
            cache.SetCacheability(_cacheability);
        }
    }
    

    Next, an action:

        [CacheControl(HttpCacheability.NoCache), HttpGet]
        public JsonResult MyAction()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm experiencing this problem: I want to add the Google Maps API to my
I'm experiencing this weird problem which my scrollbar jumps by itself to somewhere that
im experiencing this problem when deploying my django application to heroku , it says
I am currently experiencing a weird caching problem it would seem. When I load
Is anyone else experiencing this problem where if you programmatically set the selected state
I'm experiencing a serious problem when I'm trying to use the Memcached caching driver
I'm experiencing the problem described in this Android issue: http://code.google.com/p/android/issues/detail?id=4536 Simply put, after pressing
I have just started experiencing this problem: The site is fine until I add
I'm experiencing a problem while trying to use google maps api v3 (with marker
I am experiencing a problem with the following code in some versions of Internet

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.