Prevent ASP page from being cached

Author Topic
unni n
Member

Joined: 05 May 2005
Country: India
Posts: 4

Posted: 06 May 2005 13:02:31

If you attempt to use response.redirect after you've already used response.write,you'll receive an error.

the foll. code sample takes care of buffering the output to the browser as well as prevents your page from being cached by iis. this forces IIS to reprocess the page each time its called.

<%
Response.Buffer = True
Response.AddHeader "cache-control", "private"
Response.AddHeader "abcd", "no-cache"
Response.ExpiresAbsolute = #may 09, 2005 0001#
Response.Expires = 0
%>

If you attempt to use response.redirect after you've already used response.write,you'll receive an error.

the foll. code sample takes care of buffering the output to the browser as well as prevents your page from being cached by iis. this forces IIS to reprocess the page each time its called.

<%
Response.Buffer = True
Response.AddHeader "cache-control", "private"
Response.AddHeader "abcd", "no-cache"
Response.ExpiresAbsolute = #may 09, 2005 0001#
Response.Expires = 0
%>
Follow us on twitter Subscribe to our RSS feed
Activate your free membership today | Login | Currency