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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seems to be an infinite loop

Status
Not open for further replies.
Jan 7, 2005
124
US
I am coding an ASP page that seems to be going into an infinite loop and I have no idea why. Basically, I have a login page where, well, people log into the system. When a successful log in is reached the Session("UserId") is populated. In all of my subsequent pages I have listed at the top:
Code:
<%
If Session("UserId") = "" Then
	Server.Transfer "login.asp"
End If
%>
I have the Session timeout at 20 minutes in IIS so that the user needs to log in again after 20 minutes. Well when the timeout is reached, the user is redirected to the login.asp and the page keeps reloading infinitely...can anyone tell me what is going on??
 
Make sure that you don't have that same code on the "login.asp" page, or it will "refresh" indefinately.
Bent
 
yup just like bent said:
<%
If Session("UserId") = "" Then
Server.Transfer "login.asp"
End If
%>
the login.asp page shouldnt have this check or it will keep resubmitting to itself...

Known is handfull, Unknown is worldfull
 
Would

Code:
<%
if session("UserID") = "" then
   response.redirect "login.asp"
end if
%>

work?
 
No, the response.redirect shouldn't make any difference.

I have used a similar approach (mostly to stop people navigating incorrectly into a fairly complex data capture site, for example from the browser history panel). You might want to consider also overriding the default 20 minute timeout.

Linnet
 
If you remove that code from login.asp, this won't happen...You don't need it there anyway as far as I can tell.
 
Thanks for your responses...wierdest thing, I simply rebooted my computer and everything worked fine after that...I have no clue, but thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top