content expiration?

D

Daenil of GL

Ok, I am looking for how you make a webpage expire immediately so when you
hit refresh, you receive new data. In old ASP, you would just do
<%
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
Since that no longer works in ASP.NET, I was looking for how you do this
now...

Thanks,
Daniel Gormley
Visual SUN Studios
 
T

Teemu Keiski

You can set in Page directive
<% @Outputcache Location="none" %>

which should set the headers and you can do that in code:

Response.Cache.SetCacheability(HttpCacheability.NoCache)
 
D

Daenil of GL

Thank you for your reply.
On the Response.Cache.SetCacheability(HttpCacheablility.Nocache), would that
go in the old "Spaghetti Code" render blocks or something else? That is the
part that loses me.
 
D

Daenil of GL

Here is what i have tried and it doesnt work:

<%@ outputcache duration="60" varybyparam="None" %>
<% Response.Cache.SetCacheability(HttpCacheability.NoCache) %>
<% Response.CacheControl = "no-cache" %>
<% Response.AddHeader ("Pragma", "no-cache") %>
<% Response.Expires = -1 %>

This is in the very top of my page right under the <%@ Page Language="VB" %>

What am i doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top