Click here to Skip to main content
15,918,889 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys, i made a simple project that allows a user to go to another pages and in that page his name is displayed but after a minute the page will directly go back to the index page. How do i make a condition to determine that the alloted time is already met to redirect the page back to the index page? Hoping for your positive response. Thanks.

index page code
VB
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        Session("name") = TextBox1.Text
        Response.Redirect("profile.aspx")
    End Sub


profile page
VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dim timeLogger as integer
        Label1.Text = Session("name")

        Session.Timeout = 1
        timeLogger = Session.Timeout
        Label2.Text = timeLogger

        'If timeLogger = timeLogger Then
        '    Response.Redirect("index.aspx")
        'End If
    End Sub
Posted

1 solution

How to Redirect to Another Page when Session Timeout in ASP.NET (when pages contain Ajax UpdatePanel)[^] should help you out.
This[^] may offer some assistance as well - though in this article, you are taken to the login page on timeout.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900