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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:45:12+00:00 2026-06-18T01:45:12+00:00

Wanted to know about – What is the different between HttpContext.Response.Cache and HttpContext.Current.Cache objects

  • 0

Wanted to know about – What is the different between HttpContext.Response.Cache and HttpContext.Current.Cache objects ? and What should be used in Asp.net MVC web application?

Why I am asking this question?

Because, I have my own [NoCache] attribute, which is responsible to avoid cache during the view redirection.

E.g.

public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        var cache = filterContext.HttpContext.Response.Cache;
        cache.SetExpires(DateTime.Now.AddDays(-1));
        cache.SetValidUntilExpires(false);
        cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
        cache.SetCacheability(HttpCacheability.NoCache);
        cache.SetNoStore();
        base.OnActionExecuting(filterContext);
    }

And I am using this above attribute in my BaseController, like..

[NoCache]
public class BaseController : Controller
{

}

This works fine!

BUT, in the authentication part – I am storing some information in the cache by below mechanism

public ActionResult Login()
{
    HttpContext.Current.Cache.Insert("someKey", "someValue", null, expiredTime.Value, Cache.NoSlidingExpiration);
    return view();
}

SO, my Question is..

I am using my custom attribute in base class of controller, which is responsible to clear the cache items, even though, I can still access the cache key and value throughout the application which was set by the Login method code..

Why this both cache mechanism act differently? What is the difference between these two?

Could you please suggest some idea or information on this.

  • 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-18T01:45:14+00:00Added an answer on June 18, 2026 at 1:45 am

    HttpContext.Current.Cache is a class that provides caching of any kind of serializable objects. It in itself equates to HttpRuntime.Cache to muddy your waters even more.

    We use HttpContext.Current.Cache usually to cache data from our database servers. This saves having to continually ask the database for data that changes little. This is entirely server-side and does not affect the client.

    HttpResponse.Cache allows you to set up and control the various cache control headers sent with the response content. This tells the client (and any in-between proxies) what kind of caching you suggest. Note I say suggest, because it’s entirely arbitrary whether the client honors it or not.

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

Sidebar

Related Questions

I don't know enough about VB.Net (2008, Express Edition) yet, so I wanted to
Just wanted to know what could be the security cautions I should know about
Possible Duplicate: Transactions in .net I just wanted to know about Transaction in .net
I wanted to know about Data Type implementation in PHP so I need a
I wanted to know about the difference about cloud computing and distributed computing. I
Just wanted to know something about signed vs unsigned interpretation. Am I right if
i wanted to know about the data type references and some examples of how/why
I wanted to know about Hadoop more than a black box. I wanted to
I wanted to know more about tools that assist in writing code-generators for C.
I couldn't find any question similar to this one, I wanted to know about

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.