473,698 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Force Page Expiry (Back Button Issue)

Here is the code that I tried with no luck. Even though the cache is
not saved, the page still appears but goes to the server to get the
page instead of local cache. When it comes back to the page load event
the ViewState no longer exist but the session does.

Any help would be greatly appreciated!
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If Not IsPostBack Then

If IsExpired() Then
Response.Redire ct("expired.asp x")
Else
Me.SaveTimeStam ps()
End If
Response.Cache. SetCacheability (HttpCacheabili ty.NoCache)
Response.Cache. SetExpires(Now( ).AddSeconds(-1))
Response.Cache. SetNoStore()
Response.AddHea der("Pragma", "no-cache")
End If
End Sub

Private Sub LinkButton1_Cli ck(ByVal sender As System.Object, ByVal
e As System.EventArg s)

End Sub
Private Sub SaveTimeStamps( )
Dim t As DateTime = Now
ViewState.Add(" TimeStamp", t)
Session.Add("Ti meStamp", t)
End Sub
Private Function IsExpired() As Boolean
If Session("TimeSt amp") Is Nothing Then
Return False
ElseIf ViewState("Time Stamp") Is Nothing Then
Return False
ElseIf ViewState("Time Stamp").ToStrin g =
Session("TimeSt amp").ToString Then
Return False
Else
Return True
End If
End Function

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Response.Redire ct("webform2.as px")
End Sub
End Class

Jul 21 '05 #1
0 1224

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

Similar topics

1
1803
by: JezB | last post by:
I have a button which implicitly posts-back before firing the event that I have attached to that button. Within that event code I modify the controls collection on the page so I want to force another postback, how do I do this from my code-behind module ? (c# preferably).
5
1503
by: jack-e | last post by:
Hi, What is the best way to deal with the "back button" problem i.e. person clicking back and resubmitting details again. Page Expiry? If so, how do I set this? Thanks in advance.
2
1603
by: Owen | last post by:
I have a web app that is a mixture of ASP and ASP.NET pages. Largely the only data passed between them is via the querystring, or by reading from a database. However there is a requirement for one part to communicate via a cookie. (Please dont ask me to go into why, I don't have time). In my ASP page, I created a cookie and put a value in it: Response.Cookies("MyCookieName") = "OriginalValue" Response.Cookies("MyCookieName").Expires...
0
293
by: jaydfischer | last post by:
Here is the code that I tried with no luck. Even though the cache is not saved, the page still appears but goes to the server to get the page instead of local cache. When it comes back to the page load event the ViewState no longer exist but the session does. Any help would be greatly appreciated! Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
5
5441
by: kplkumar | last post by:
Hi I am doing a manual timeout, irrespective of whether the user is active or not I will time them out after 3 hours. I also make sure the page is not cached so that they can't go back to the page from which they were timedout. The problem now is that when they go back to their page(which says the page has expired) and click on the refresh button in the browser they are somehow authenticated and a new session is created.
0
991
by: Charles Mifsud | last post by:
Hi, We have an ASP.NET 2.0 web page with user authentication. We have a page which contains a Multiview with a number of different views. Each view represents one step in a whole process. The user can move from one step to another using the WebControl Buttons (Next and Back) we provided on the views. Once the User comes in the last view and presses finish we do not want the user to click the Browser Back button, but expire somehow the...
0
964
by: Walter Psaila | last post by:
Hi, We have an ASP.NET 2.0 web page with user authentication. We have a page which contains a Multiview with a number of different views. Each view represents one step in a whole process. The user can move from one step to another using the WebControl Buttons (Next and Back) we provided on the views. Once the User comes in the last view and presses finish we do not want the user to click the Browser Back button, but expire somehow the...
1
3489
by: Rob | last post by:
I know this is an old one, considering how many posts I found on it but I just wondered if any best practises had popped up recently, especially as Ajax has increased JavaScript and DHTML's importance. I'm writing a database application. I like pop-up boxes so I've implemented one on my webpage using a floating DIV. The logic goes like this: 1. When the page is rendered (on the server), it adds "var DisplayPopup = false;" in the page...
41
2807
by: Twayne | last post by:
Hi, How would I go about "forcing" a user from one page to another? I have a very simple random question/answer entrance requirement for an e-mail form. After 3 page views most people are going to have successfully submitted their e-mail (enter/validate as human, enter message, send the message). If someone or something decides to start banging on any of the pages and increses the views count too far I want to kick them out to an...
0
8676
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
8608
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
9029
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
8897
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7732
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
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
4370
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.