473,411 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

No-Cache and Expiry

Does anyone know how to make an ASP.NET (C#) page expire immediately and not
be cached?
What I want to happen is if the users pressed the BACK button they get a
page has expired and has to be reloaded message.
I've tried just placing the standard HTML meta tags in but that doesn't seem
to work. I've also tried using the Cache objects properties too. That didn't
seem to work either.

Anyone any ideas?

Thanks,
Gareth
Nov 18 '05 #1
2 4391
Check out this faq,
http://www.extremeexperts.com/Net/FA...ackButton.aspx
--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com

"Gareth" <gcparris at hotmail dot com> wrote in message
news:OS**************@TK2MSFTNGP11.phx.gbl...
Does anyone know how to make an ASP.NET (C#) page expire immediately and not be cached?
What I want to happen is if the users pressed the BACK button they get a
page has expired and has to be reloaded message.
I've tried just placing the standard HTML meta tags in but that doesn't seem to work. I've also tried using the Cache objects properties too. That didn't seem to work either.

Anyone any ideas?

Thanks,
Gareth

Nov 18 '05 #2
Place the following code at the top of your aspx page.

<% System.Web.HttpContext.Current.Response.AddHeader( "Cache-Control","no-cache")
System.Web.HttpContext.Current.Response.Expires = 0
System.Web.HttpContext.Current.Response.Cache.SetN oStore()
System.Web.HttpContext.Current.Response.AddHeader( "Pragma", "no-cache")%>

Tommy,

"Gareth" <gcparris at hotmail dot com> wrote in message news:<OS**************@TK2MSFTNGP11.phx.gbl>...
Does anyone know how to make an ASP.NET (C#) page expire immediately and not
be cached?
What I want to happen is if the users pressed the BACK button they get a
page has expired and has to be reloaded message.
I've tried just placing the standard HTML meta tags in but that doesn't seem
to work. I've also tried using the Cache objects properties too. That didn't
seem to work either.

Anyone any ideas?

Thanks,
Gareth

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: banaticus | last post by:
What does this error message mean? What can I do to fix it? Here'e the command that I just tried running, and the messages that I received. I just barely unpacked python. linux:/Python-2.4 #...
2
by: asdf | last post by:
Hello, I was enjoying working in VS for half a year without any problems and now I cannot debug anymore. Without any really reason my Studio tells me that the page that I want to debug has - No...
9
by: Colin McGuire | last post by:
Hi, I have an report in Microsoft Access and it displays everything in the table. One column called "DECISION" in the table has either 1,2, or 3 in it. On my report it displays 1, 2, or 3. I want...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
0
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
59
by: Lennart Björk | last post by:
Hi All, I have a tiny program: <!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>MyTitle</title> <meta...
3
by: Rahul B | last post by:
Hi, I have a user UCLDEV1 which is a part of staff and a group(db2schemagrp1) to which i have not given any permissions. The authorizations of that user are shown as db2 =get authorizations...
0
natalie99
by: natalie99 | last post by:
Hey people! Being so lacking in access knowhow I have turned to good old 'asking the smart people' again! I need to create a query or lookup table (although I have had zero success with lookups...
2
Parul Bagadia
by: Parul Bagadia | last post by:
I have written a code for deleting certain value from linklist; it's not working; where as i have written one for deleting a no., after given no. which works fine! I even debugged it; but invain;...
1
by: sora | last post by:
Hi, I've developed a MFC program under VS 6.0. My debugger *was* working fine and I've used it often for my project. Then, one day, the errors below appear and they prevent me from using the...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.