Visual Studio .NET - How to disable cache in Asp.Net ?

Asked By Nagaraj muthuchamy on 13-May-08 10:24 AM

Hi,

I have doubt in Browser cache in Asp.Net.

I have a website with search box, Now i want to disable to cache for search results page.

For ex: I am opening the homepage and search for some Key, It takes me to search result page,I try search for some more words in that page. When i click on the Back Button in browser , It brings the last results page, after making some some more clicks in back button, It takes me to actual page where i came from. Try with (http://www.google.com)

Is there anyway to bring the Non-Search Result Page while clicking browser back button from the Search Results Page.

Thanks

Nagaraj.M

Disable Output Cache for an individual page / entire application - Rakesh Vikram replied to Nagaraj muthuchamy on 13-May-08 10:50 AM

There are various soutions for disabling cache. 

---------------------------------------                                                                      

<%@ OutputCache Duration="0" VaryByParam="none" %>

---------------------------------------                                                                      

This one line, at the top of your aspx page or in your page_load event handler, prevents the web page from being saved in the client cache.

Response.Cache.SetCacheability(HttpCacheability.NoCache)

Also refer this link for more information:

http://www.freevbcode.com/ShowCode.Asp?ID=243

---------------------------------------    

For more information refer the below articles:

http://support.microsoft.com/kb/247404

http://www.mnogosearch.org/doc/msearch-srcache.html

---------------------------------------  

Hope this helps in finding a solution. All the Best!!

Rakesh Vikram

See This - Shailendrasinh Parmar replied to Nagaraj muthuchamy on 14-May-08 01:14 AM

See the following artiele, it may help you...

http://dotnetslackers.com/articles/ajax/HandlingTheBackButtonFromServerCode.aspx