Asp.net ile Cache pasif yapmak
17 Mayıs 2022 / 08:44
Burak
Merhaba arkadaşlar,
Asp.net cache olayını kimi zaman pasif hale getirmek isteyebiliriz.İşte böyle durumlar sayfamızın page_load eventına aşağıdaki kodu yazmanız yeterlidir.
1 2 3 4 5 |
HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(false); HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); HttpContext.Current.Response.Cache.SetNoStore(); Response.Cache.SetExpires(DateTime.Now); Response.Cache.SetValidUntilExpires(true); |
Ayrıca bunlara ek olarak web.config’de aşağıdaki kodu eklemeniz yeterlidir.
1 2 3 |
<system.webServer> <caching enabled="false" enableKernelCache="false" /> </system.webServer> |
Bu Yazılarıda Okuyabilirsiniz...
Bir yanıt yazın