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 7799381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:17:26+00:00 2026-06-02T00:17:26+00:00

I have a controller which calls a method in the controller called GetTypes() [OutputCache(Duration

  • 0

I have a controller which calls a method in the controller called GetTypes()

[OutputCache(Duration = 6000)]
public List<SelectListItem> GetTypes()
{
   return Datetime.Now();
}

Why does this method not cache if I call it from inside of my controller from another action method? It only seems to cache when I call it directly using the URL or @Render..

“localhost/home/GetTypes”

  • 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-06-02T00:17:27+00:00Added an answer on June 2, 2026 at 12:17 am

    Yes, that is the way it works, and the way it should work.

    The reason is that attributes do not magically work. Something must examine them and do things based on them. That code is part of the normal pipeline of MVC when processing a request.

    When you call that method directly, you bypass the normal pipeline, thus attributes do not get evaluated and/or run.

    Beyond that, just simple common sense should tell you that caching only applies to a response. If there is no response (because you called it directly) it would not apply.

    What you should do is execute a child action instead. How you would do that differs depending on where and how you are calling the method. So unless you show us the code that calls the method (and its surrounding context) i can’t help you further.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a controller which has a method called history class UsersController < ApplicationController
I have a method in a codeigniter controller which is sometimes called through the
Hi guys i have controller which returns a partial view, the controller is called
I have a UITableViewController which in it's tableView:didSelectRowAtIndexPath method, sets up a view controller,
I have a controller called EmailController , which is (you guessed it) responsible for
I have a controller action which I would like to call another controller action.
I have a controller which allows only POST for certain actions: static allowedMethods =
i have view controller which contains a button which show the image library ,if
I have an controller which is an ArrayProxy and contains some computed arrays. In
I have a navigation controller which also has a table view. I want to

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.