473,396 Members | 1,757 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,396 software developers and data experts.

page expiration

kpg
Hi all, easy question:

How can I make a page expire immediately?

I don't want the user to be able to re-visit it.

Tried <% response.expires = 0 %>, did not work.

Don't understand how to use the System.Web.HttpCachePolicy

???

Thanks
kpg
Nov 19 '05 #1
10 1701
Setting Response.Expires to 0 just makes it so the browser doesn't cache the
page, which doesn't sound at all like the solution to your problem.

Are you saying that if someone sees a certain page, then if they refresh or
return to it, you want them to see something else or be redirected?
"kpg" <ip***@thereforeiam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi all, easy question:

How can I make a page expire immediately?

I don't want the user to be able to re-visit it.

Tried <% response.expires = 0 %>, did not work.

Don't understand how to use the System.Web.HttpCachePolicy

???

Thanks
kpg

Nov 19 '05 #2
kpg
> Setting Response.Expires to 0 just makes it so the browser doesn't cache
the page, which doesn't sound at all like the solution to your problem.

Are you saying that if someone sees a certain page, then if they refresh
or return to it, you want them to see something else or be redirected?


After the user logs on I show a page that displays a list of items
previously
saved. When the user picks one I redirect them to a page with the selected
data loaded to begin processing. If they hit the back button (history) of
the
browser and try to revisit the item list page I want to show that it has
expired.
There should be no way for them to return to this page unless they logoff
and then back on.

If the page were not cached then the request would come to the server
and I could display a message. My problem is I put a response.expires =0
and I still got the cached page. Maybe I was using it wrong. I added it to
the top of the html page before the <head>. I also tried adding a
response.expires = 0 into the page load event with the same effect (none).

Hope that clears it up.

Thanks,
kpg

Nov 19 '05 #3
When they visit the page, put a variable on the session to indicate
that they have vitited. When they come back, the session will have the
value and you can display an appropriate message.
sayed

Nov 19 '05 #4
The problem with the back button is an age old issue and I'm very interested
to see if anyone is going to offer you a solution. When a user clicks the
back button, the page doesn't reload, so no code is executed.
"kpg" <ip***@thereforeiam.com> wrote in message
news:e0**************@TK2MSFTNGP12.phx.gbl...
Setting Response.Expires to 0 just makes it so the browser doesn't cache
the page, which doesn't sound at all like the solution to your problem.

Are you saying that if someone sees a certain page, then if they refresh
or return to it, you want them to see something else or be redirected?


After the user logs on I show a page that displays a list of items
previously
saved. When the user picks one I redirect them to a page with the
selected
data loaded to begin processing. If they hit the back button (history) of
the
browser and try to revisit the item list page I want to show that it has
expired.
There should be no way for them to return to this page unless they logoff
and then back on.

If the page were not cached then the request would come to the server
and I could display a message. My problem is I put a response.expires =0
and I still got the cached page. Maybe I was using it wrong. I added it
to
the top of the html page before the <head>. I also tried adding a
response.expires = 0 into the page load event with the same effect (none).

Hope that clears it up.

Thanks,
kpg

Nov 19 '05 #5
kpg
OK. Here it is.

Put this in the page load event: Response.Cache.SetNoStore()

This prevents the browser from caching the page, which
means I will always get the hit when the page is reloaded.

I found this info at:

http://www.codenotes.com/articles/ar...articleID=1022

--
kpg

"Kim Quigley" <ki********@hotmail.com> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
# Name resolution details: file://c:\temp\328821.htm (6/17/2005 2:00:56 PM)
#
The problem with the back button is an age old issue and I'm very
interested to see if anyone is going to offer you a solution. When a user
clicks the back button, the page doesn't reload, so no code is executed.
"kpg" <ip***@thereforeiam.com> wrote in message
news:e0**************@TK2MSFTNGP12.phx.gbl...
Setting Response.Expires to 0 just makes it so the browser doesn't cache
the page, which doesn't sound at all like the solution to your problem.

Are you saying that if someone sees a certain page, then if they refresh
or return to it, you want them to see something else or be redirected?


After the user logs on I show a page that displays a list of items
previously
saved. When the user picks one I redirect them to a page with the
selected
data loaded to begin processing. If they hit the back button (history)
of the
browser and try to revisit the item list page I want to show that it has
expired.
There should be no way for them to return to this page unless they logoff
and then back on.

If the page were not cached then the request would come to the server
and I could display a message. My problem is I put a response.expires =0
and I still got the cached page. Maybe I was using it wrong. I added it
to
the top of the html page before the <head>. I also tried adding a
response.expires = 0 into the page load event with the same effect
(none).

Hope that clears it up.

Thanks,
kpg



Nov 19 '05 #6
Try this code:
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"kpg" <ip***@thereforeiam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi all, easy question:

How can I make a page expire immediately?

I don't want the user to be able to re-visit it.

Tried <% response.expires = 0 %>, did not work.

Don't understand how to use the System.Web.HttpCachePolicy

???

Thanks
kpg

Nov 19 '05 #7
kpg wrote:
Hi all, easy question:

How can I make a page expire immediately?

I don't want the user to be able to re-visit it.

Tried <% response.expires = 0 %>, did not work.

Don't understand how to use the System.Web.HttpCachePolicy


HttpResponse has a "Cache" property which is a instance if
HttpCachePolicy. You should set your caching options through this
object, e.g.

Response.Cache.SetCacheability(HttpCacheability.No Cache);

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #8
kpg wrote:
OK. Here it is.

Put this in the page load event: Response.Cache.SetNoStore()

This prevents the browser from caching the page, which
means I will always get the hit when the page is reloaded.


Note that there's no guarantee that this works across all browsers.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #9
add this line to ur html coding
it will prevent user from hitting the back button of our browser...

<body onload="history.go(+1)" MS_POSITIONING="GridLayout">
try it and c whether it has any affect?

email me at

ja********@gmail.com

kpg wrote:
Hi all, easy question:

How can I make a page expire immediately?

I don't want the user to be able to re-visit it.

Tried <% response.expires = 0 %>, did not work.

Don't understand how to use the System.Web.HttpCachePolicy

???

Thanks
kpg

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200507/1
Nov 19 '05 #10
add this line to ur html coding
it will prevent user from hitting the back button of our browser...

<body onload="history.go(+1)" MS_POSITIONING="GridLayout">
try it and c whether it has any affect?

email me at

ja********@gmail.com
Kim Quigley wrote:
The problem with the back button is an age old issue and I'm very interested
to see if anyone is going to offer you a solution. When a user clicks the
back button, the page doesn't reload, so no code is executed.
Setting Response.Expires to 0 just makes it so the browser doesn't cache
the page, which doesn't sound at all like the solution to your problem.

[quoted text clipped - 24 lines]
Thanks,
kpg

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200507/1
Nov 19 '05 #11

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

Similar topics

0
by: | last post by:
Which of these scenarios is better: A -- User Registers and is returned to the login screen to test his new username ie (email address). A login script checks user name against database....
3
by: Zaccariah Kowalsky | last post by:
Hello, I have a webapp with on each page a "language" drop down list. Now, if I choose X, I want to initialise the drop down list to X. Easy to understand. But what is the best way to do this in...
5
by: Kenneth Keeley | last post by:
Hi, I have a web app that has forms authentication and I can login to the page the first time I go there but it never times me out if I come back in 24 hours a hit the refresh key the page loads...
3
by: naijacoder naijacoder | last post by:
what i need i think its a session timeouts. Which i'm using like:- <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data...
2
by: Bill Borg | last post by:
Hello all, I am working on forms authentication and trying to understand: what's the relationship between the cookie expiration and the ticket expiration? I create a cookie and I add an...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
3
by: Aaron | last post by:
I'm trying to parse a table on a webpage to pull down some data I need. The page is based off of information entered into a form. when you submit the data from the form it displays a...
6
by: Sonnich | last post by:
Hi! How do I set the timeout for a page? Session.timeout is for the sesstion AFIAK. BR Sonnich
1
by: Danny Ni | last post by:
Hi, I have a page CourseEditor.aspx to allow users to modify course information. I am having problem with page expiration. Here are the steps I take to reproduce the problem: (1) I open a...
5
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a site which I secure with forms authentication. When the user's sign on and hit one of the secure pages, I have this line in my code to ensure that the browser does not cache the page;...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.