Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to disable page caching in Asp.net

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to disable page caching in Asp.net". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to disable page caching in Asp.net.

1. Add to the header of the Asp page

The copy code is as follows:

Response.Buffer = True

Response.ExpiresAbsolute = Now ()-1

Response.Expires = 0

Response.CacheControl = "no-cache"

Response.AddHeader "Pragma", "No-Cache"

2. Add to the HtML code

The copy code is as follows:

3. Pass a parameter Href= "* .asp? random ()" to the page when the original page is called again.

The first two methods are said to sometimes fail, while the third is to pass a random parameter when jumping! Because aspx's caching is parameter-dependent, caching is not used if the parameters are different, but the page is regenerated, and caching can be avoided by passing a random parameter each time. This only applies to asp&asp.net

4. _ window.location.replace ("WebForm1.aspx")

The parameter is the page you want to overwrite. The principle of replace is to replace the page specified by the replace parameter with the current page.

This prevents the user from clicking the back key. The javascript script is used, as an example:

A.html

The copy code is as follows:

A

Function jump () {

_ window.location.replace ("b.html")

}

B

The first three only empty the cache, that is, temporary files stored in the Temporary Internet Files folder, while the fourth is to replace the current page file with a jump page file, and does not empty the cache, which means that Temporary Internet Files produces the relevant temporary files.

Thank you for reading, the above is "how to achieve Asp.net disable page cache" content, after the study of this article, I believe you on how to achieve Asp.net disable page cache this problem has a deeper understanding, the specific use of the need for everyone to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report