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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:25:32+00:00 2026-05-25T20:25:32+00:00

In IIS7, I have a .ashx file from a third party which sets caching

  • 0

In IIS7, I have a .ashx file from a third party which sets caching headers to be no-cache,private

I want this to be cached on the client so I have added the following code to the global.asax

void Application_EndRequest(object sender, EventArgs e)
{
    if (Request.Path.IndexOf("Script.ashx") > -1)
    {
      Response.Cache.SetCacheability(HttpCacheability.Public);
      Response.Cache.SetExpires(DateTime.Now.AddDays(7));
      Response.Cache.SetValidUntilExpires(true);
      Response.Cache.VaryByHeaders["Accept-Language"] = true;
    }
}

I would expect the resulting cache information to be public, Expires: Thu, 29 Sep 2011 16:06:27 GMT

Instead however I get the Franken-response of no-cache,public Expires: Thu, 29 Sep 2011 16:06:27 GMT

So the code is taking replacing the private with public as I want but it fails to replace the no-cache directive. Is it possible to replace the no-cache directive with this approach: if so what am I missing; if not what other approaches are there?

  • 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-25T20:25:32+00:00Added an answer on May 25, 2026 at 8:25 pm

    The above code fails in IIS7 Classic mode but the Integrated mode the code works as expected and produces sensible response headers. I assume this is due to the way that classic works similar to an ISAPI filter. I have switched to Integrated mode and this has solved the issue.

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

Sidebar

Related Questions

When we have a .js file which we reference from a View page and
I have a text like this: 'Rails on IIS7 http://is.gd/vWPn ' (it's a tweet
I have written ashx which merges and remove white-spaces for javascript and css contents.
I have an HttpHandler configured in my web.config file like so: <add verb=GET,HEAD,POST path=TinyMCE.ashx
We have a WCF (.NET 3.5 SP1) service running in IIS7, which is marked
I'm trying to move our site from a IIS6 to IIS7 and have a
This is not an MVC topic. I have an ASP.NET Application which performs URL
I have Vista with IIS7 . I want to create a simple Silverlight application
I have a WCF service hosted in IIS7 with netTCP enabled. This is my
I have an IIS7 web application which primarily serves web service requests. As part

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.