Showing posts with label asp.net. Show all posts
Showing posts with label asp.net. Show all posts

Thursday, December 25, 2008

Disable browser caching in asp.net

To improve speed and response to user, some browsers cache the whole webpage. when user request for same page, instead of going to server, browsers server this page from the cache.
This approach can create problem, browser caches a secured page, which user should see only if he is login. There is a way to force the browser not to cache an ASP.NET web page and you need to add only 1 line of code to your ASP.NET web pages in order to disable browser caching. 

Add the following line on top of the Page_Load event handler and your ASP.NET page will not be cached in the users browsers: 

Response.Cache.SetCacheability(HttpCacheability.NoCache)

Tuesday, December 9, 2008

Asynchronous operations are not allowed in this context. Page starting an asynchronous operation has to have the Async attribute set to true

If you get this error when calling web service asynchronously, add the Async=”true” attribute in the page directive at the top of page.