what is the use of Response.Cache.SetCacheability?

Posted by Prabu_Spark under ASP.NET on 1/6/2013 | Points: 10 | Views : 9283 | Status : [Member] | Replies : 2
Hi sir,
What is the purpose of using these code in asp.net?

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetAllowResponseInBrowserHistory(false);

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

Posted by: Saratvaddilli on: 1/7/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
NoCache: Sets the Cache-Control: no-cache header. Without a field name, the directive applies to the entire request and a shared (proxy server) cache must force a successful revalidation with the origin Web server before satisfying the request. With a field name, the directive applies only to the named field; the rest of the response may be supplied from a shared cache.

When HttpCacheability is set to NoCache or ServerAndNoCache the Expires HTTP header is by default set to -1; this tells the client not to cache responses in the History folder, so that when you use the back/forward buttons the client requests a new version of the response each time.

once go through this link
http://stackoverflow.com/questions/3854955/what-it-means-response-cache-setcacheabilityhttpcacheability-nocache-respons

Thanks and Regards
V.SaratChand
Show difficulties that how difficult you are

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Peermohamedmydeen on: 1/7/2013 [Member] Bronze | Points: 25

Up
0
Down
The
Response.Cache.SetCacheability(HttpCacheability.NoCache)
refers to let the browser knows to not to cache this page. So the browser does not cache any page specific resources.
The
Response.Cache.SetAllowResponseInBrowserHistory(false)
refers to let the browser knows to not to allow this page in the browse history. So you cannot see the page in the browser history.



Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response