473,659 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page caching using Response.Expire s = 0

Hi

I'd like to stop a particular ASP page from being stored in the history so
visitors cannot use their browser's back button to return to it. I've used
Response.Expire s = 0 along with this:

Response.CacheC ontrol = "no-cache"
Response.AddHea der "Pragma", "no-cache"
Response.Expire s = -1

And neither of them seem to work.

Forgive me if I seem a little dumb, but is this possible?

The page in question is where a customer's gift voucher gets redeemed. Some
vouchers have a set number of times they can be used, and I want to stop
users going back to the page to redeem it again if there was a comms error
and they didn't make it to the next page for some reason. Any ideas?

Is there also a way of detecting that they have been disconnected or a
problem has occurred, and thus allowing them to use their voucher again. I
have already sorted it with a bit of JavaScript so that the "Redeem" button
can only be clicked once.

Kind regards,
Greg
Jul 21 '05 #1
2 5629
>>but is this possible?
No. You cannot prevent pages from being added to the history with ASP. You
may be able to find some client-side code - I don't know.
if there was a comms error
What's a "comms error"

Why don't you just track the voucher redemption in a database?

Bob Lehmann

"Greg" <te**@jmswebdes igns.com> wrote in message
news:%2******** **********@TK2M SFTNGP15.phx.gb l... Hi

I'd like to stop a particular ASP page from being stored in the history so
visitors cannot use their browser's back button to return to it. I've used
Response.Expire s = 0 along with this:

Response.CacheC ontrol = "no-cache"
Response.AddHea der "Pragma", "no-cache"
Response.Expire s = -1

And neither of them seem to work.

Forgive me if I seem a little dumb, but is this possible?

The page in question is where a customer's gift voucher gets redeemed. Some vouchers have a set number of times they can be used, and I want to stop
users going back to the page to redeem it again if there was a comms error
and they didn't make it to the next page for some reason. Any ideas?

Is there also a way of detecting that they have been disconnected or a
problem has occurred, and thus allowing them to use their voucher again. I
have already sorted it with a bit of JavaScript so that the "Redeem" button can only be clicked once.

Kind regards,
Greg

Jul 21 '05 #2
Hi

Don't think I was that clear when writing my initial post. Sorry! I'll try
to be more descriptive and to the point!

The voucher codes are stored in a table "VOUCHER" in my database, and when a
voucher is redeemed it's "NumberOfUs es" field is decremented. If this field
is currently set to 1, it is then set to -1 and not 0 to indicate that the
voucher has become invalid. If the value is 0, the voucher has no usage
limit.

When the user clicks the "Redeem" button, I forward to a page which changes
the value of the "NoOfUses" field. This works fine and produces the desired
result.

However, assume that the user redeems a voucher that can be used twice, ie.
"NoOfUses" is set to 2. When they click "Redeem" the field's value is set to
1 by the page they are redirected to. There is nothing stopping the user
from using the back button of their browser to return to the page with the
"Redeem" button on it, and redeem the voucher again. They may need to do
this if an error had occurred at the server or they had lost their Internet
connection preventing the next page from displaying correctly.

I already have a warning next to the "Redeem" button stating that it should
only be clicked once and that if the user has any problems they should NOT
to press it again, instead they should contact the company who can issue
them with another voucher.

I was just wondering if there was a way to prevent the same voucher being
redeemed in the same session. As I'm writing this I am thinking that I could
set a session variable to use as a flag saying that a voucher has been
redeemed, and that if it is set, don't let it be redeemed again!

Any thoughts?

Kind regards,
Greg
Jul 21 '05 #3

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

Similar topics

12
10161
by: VB Programmer | last post by:
I know some sites will display the following message if you click on the BACK button in your browser. How do I implement this feature? Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. To resubmit your information and view this Web page, click the...
5
3129
by: R. Ian Lee | last post by:
I have an ASP.NET page that spawns a popup window using javascript's window.open. This works fine. It pops up, you enter some data, press save and everything saves as it should. But, if you click the button to open the popup again, then it opens with the values that were in it before the "save" was executed. I've determined that the problem is that IE is storing the page in it's local temporary internet files cache and isn't going to...
13
2307
by: Veeresh | last post by:
I am using .Net 1.1. How to expire an .aspx page? I think I have to use HttpCachePolicy class for this. But not sure how to use and where to this code to work. Is it in Page_load event. Thanks Veer
3
1444
by: Adrian Parker | last post by:
IE.. Tools -> Internet Options -> Settings Button -> Check for newer versions of stored pages = Never If a user changes thier settings to this, then pages are cached in IE. From what we've found, you have to use the following Meta tags in the HEAD section to stop it doing it. meta http-equiv="Pragma" content="no-cache" meta http-equiv="Expires" content="0"
10
1723
by: kpg | last post by:
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
0
1533
by: Frankie | last post by:
When I want to prevent a page from being cached, I have been using the following directive: <%@ OutputCache Location="none" %> I have also seen a few other methods recommended to prevent page caching. like these... Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache");
14
11882
by: rolfejr | last post by:
I am trying to display a PDF in the users browser that is pulled from a binary field in our database, and keep that PDF from caching on the client computer. I can successfully pull the PDF and display it using the following code: Response.ContentType = "application/pdf" Response.BinaryWrite objRS("Attachment") where objRS("Attachment") is a reference to the binary field retrieved from the database. However, I have tried adding...
3
2504
by: =?Utf-8?B?cHJhZGVlcF9UUA==?= | last post by:
Hi All, Can anyone please explain me why I am not able to disable Browser caching in ASP.net by writing the following code Response.Buffer = true; Response.ExpiresAbsolute = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0)); Response.Expires = 0; Response.CacheControl = "no-cache";
12
2061
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I'm using ASP.Net with an UpdatePanel. When the screen is exercised via a Web Test, the Web Test shows that the AJAX scripts are downloaded for every partial post back. My impression was that IE would cache these scripts so that the AJAX script download would only occur once. What am I missing?
0
8427
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8330
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6178
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.