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

  • Home
  • SEARCH
  • 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 5934249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:05:16+00:00 2026-05-22T15:05:16+00:00

I have one action has these attributes: [OutputCache(Location = System.Web.UI.OutputCacheLocation.Server, Duration = 300, VaryByParam

  • 0

I have one action has these attributes:

  [OutputCache(Location = System.Web.UI.OutputCacheLocation.Server, Duration = 300, VaryByParam = "*")]

and another with

  [OutputCache(Location = System.Web.UI.OutputCacheLocation.None)]

and they both use the same View.

In the View, or even in the Action Method, how to I determine what the caching is? i.e. is it a cached page or not? I’ve tried looking at Response.Headers (only has “Server: Microsoft-IIS/7.0), & Response.CacheControl is “private” in both cases.

  • 1 1 Answer
  • 2 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-22T15:05:17+00:00Added an answer on May 22, 2026 at 3:05 pm

    I haven’t used this in the application, but for the sake of seeing if it’s possible, I’ve done this sample… using Reflection, and a base controller, and calling Initialize() from my action method, the following code gets the OutputCache attributes from the calling method. Then a View or Partial View can get the cache location from the ViewBag.

    public class BaseController : Controller
    {
        public void Initialize()
        {
            var stackTrace = new StackTrace();
    
            if (stackTrace.FrameCount >= 1)
            {
                var methodBase = stackTrace.GetFrame(1).GetMethod();
    
                var filters = (OutputCacheAttribute[])methodBase.GetCustomAttributes(typeof(OutputCacheAttribute), false);
    
                if (filters.Length > 0)
                {
                    ViewBag.CacheLocation = filters[0].Location;
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form which has a lot of attributes. One of them is
I have one custom action (add) and two custom objects (favorites list) and (tv
Right now I have a single sound playing from one action, button press, accelerometer,
I have an action in one of my controllers which creates a downloadable zip
I have a flash application written in action script 2, and at one point
I have below html code in one of the opensource project. <form action=/wiki/bin/view/Main/Search> <div
I have one <asp:Image ID=imgBanner1 runat=server/> control in my aspx page, then in code
If the controller action has the OutputCache attribute specified on an action, is there
I want to have one callback function after actions are done, I'm trying something
have one time consuming step that flattens a bunch of files. basically i'd like

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.