ASP. NET Cache

Source: Internet
Author: User
Tags internet cache

The cache for ASP. NET is divided into 3 types:

The first type: page Caching

Just add at the top of the page: <% @OutputCache duration= ' varybypara= ' None '%>

Druation: Cache time, 60 seconds

Varybypara: parameter, whether based on the parameter cache

Discacheenable= ' True|false ': Cache is saved on disk

The second type: data cache : cache: When a customer browses a page, IE automatically generates a page in the temporary file, so when the page data is modified, the data is again accessed from the previous

At this point there are 2 solutions, the first is the ie--internet option-General---Internet cache files-every time you visit a webpage, the latest version

But this approach needs to be set up by the customer, not the best solution;

The second solution is to add this sentence to the page load event:

Context.Response.Cache.SetCacheability (httpcacheability.nocache); Can

In this way, there are no pages in the temporary Internet files, but if the page has a picture or JS file, it will be downloaded to the temporary Internet file.

ShowModalDialog () function in 2.JS disables page caching when an ASPX page is opened


Load plus response.expires =-1, meaning that the page immediately expires;

The third type: data source Caching :

data Source: cacheexpirationpolicy= "Sliding"

Using the "swipe" window to cache, assuming that the cache time is 10 minutes, then from someone access start 10 minutes cache, as long as someone access, 10 minutes from the moment of access, and so on, can be unlimited cache down

ASP. NET Cache

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: 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.