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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:39:34+00:00 2026-06-11T23:39:34+00:00

I recently added some HTTP caching headers to some of my web service’s responses,

  • 0

I recently added some HTTP caching headers to some of my web service’s responses, but they so far haven’t done anything for me on the client side. Here’s one of these responses:

HTTP/1.1 200 OK
Cache-Control: public, max-age=60
Transfer-Encoding: chunked
Content-Type: application/vnd.com...
Expires: Thu, 27 Sep 2012 03:40:27 GMT
Server: Microsoft-IIS/7.5
Set-Cookie: DDRSSID=...
X-DDVS-Version: 1.0.0.0
X-Powered-By: ASP.NET
Date: Thu, 27 Sep 2012 03:40:22 GMT

According to both Fiddler and REDbot, this response should be entirely cacheable. Here’s what Fiddler says:

public: This response MAY be cached by any cache.
max-age: This resource will expire in 1 minutes. [60 sec]

Even so, the responses are not coming from cache: I see them in Fiddler and the IsFromCache property on my HttpWebResponse is false. Here’s the content of my request, fwiw:

GET http://floater/rest/folders/folder.20 HTTP/1.1
Accept: application/vnd.com....
Authorization: Basic blahblah
Host: floater

What am I missing?

  • 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-11T23:39:35+00:00Added an answer on June 11, 2026 at 11:39 pm

    It turns out that there wasn’t anything wrong with my headers. Rather, the problem was that the default caching policy for HttpWebRequest is not HttpRequestCacheLevel.Default. My bad, I guess.

    By adding the following line to my request initialization I was able to see the caching results I expected:

    webRequest.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.Default);
    

    Another problem I had while testing this in various respects was that responses are not cached unless you read the entire response (eg. by reading to the end of GetResponseStream()). This is thankfully noted in the documentation:

    A copy of a resource is only added to the cache if the response stream for the resource is retrieved and read to the end of the stream.

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

Sidebar

Related Questions

I recently added some url re-writing to my web application and had to added
I recently added some namespaces to my web.config file so that all of my
I recently added some SQL functions to my database via a migrate, and they
I recently set up a local copy of Wordpress, added some content and created
I recently added some css to my website, it works perfectly fine in all
Recently I've added some load-balancing capabilities to a piece of software that I wrote.
I recently installed VisualSVN Server. I put Repository on D:\Repositories and added some projects
I recently added some of my Visual Studio 2010 projects to a solution, and
I have been using Spring Security 2.x for some time now, but recently I
I only recently added a .gitignore file to ignore some specific data files in

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.