Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems redirecting to same page

Status
Not open for further replies.

cosmoh2o

Programmer
Jul 22, 2002
92
US
Please help,

I am having trouble using an aspx page as a "loop". I have 2 session variables "LAST" and "TOTAL" such that "LAST" holds the last page load count (starting at 0) and "TOTAL" holds the total number of loops.

The user enters the "TOTAL" value and the page is continually redirected to until "LAST" >= "TOTAL". The problem is that after 3 loops, the session variables lose their value. Below is an example of the code on the page being looped:

Private total As String
Private last As String


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

Me.total = Session("TOTAL")
Me.last = Session("LAST")

If (last < total) Then
Label1.Text = last
Label2.Text = total

Else
Response.Redirect(&quot;finished.aspx&quot;)
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Session(&quot;LAST&quot;) = Session(&quot;LAST&quot;) + 1
Session(&quot;TOTAL&quot;) = Me.total
Response.Redirect(&quot;ques.aspx&quot;)
End Sub

ques.aspx is the name of the asp net page being looped, after 3 the &quot;finished.aspx&quot; page is brought up. Please help. A big THANK YOU to anyone with ideas.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top