Some issue records of the Code setting output cache Header

Source: Internet
Author: User

There are two call methods when setting the response cache header:

  1. Response. headers. Add (string key, string value)
  2. Response. cache. setmaxage (datetime)

 

InProgramIt is strange to encounter two problems in the application.

  1. My response. addheader ("last-modified", gtmttimestring) and then set response. cache. setmaxage (New timespan (7, 0, 0, 0 ))
    The result does not have the first header in the output, and then response. cache. setlastmodified (lastmodified) is enough.
    Guess: the output header cannot be used in two ways.
  2. Because the project requires that cache-control be set to public, I first response. cache. setcacheability (httpcacheability. Public), and then encountered a strange problem.
    Because my program is a handler processing program, the sent ashx request will not be updated, and the same content will be returned each time. The content will be updated when the image is refreshed, And I will understand the original httpcacheability. public has been started.
    Therefore, the results returned after the first time are all server-side caches.

     

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.