PRB: Session_OnStart Event Enters Infinite Loop (284466)
The information in this article applies to:
- Microsoft Active Server Pages
This article was previously published under Q284466 SYMPTOMS
When you use the Response.Redirect method in the Session_OnStart event, the event enters an infinite loop.
CAUSE
When a user browses the first .asp page in a Web site, the Global.asa file in that virtual directory fires the Session_OnStart event. If the user is redirected to another page in the same application, Global.asa fires the Session_OnStart event again. This behavior continues until a session is initialized. As a result, if the user is redirected before the session is initialized, the server continually fires a new session.
RESOLUTION
To resolve this problem, provide code that initializes the session prior to redirection. For example:
<SCRIPT RUNAT=Server LANGUAGE=VBScript>
Sub Session_OnStart
'Add code here to initialize the session
Session("init") = True
Response.Redirect("somepage.asp")
End Sub
</SCRIPT>
Modification Type: | Major | Last Reviewed: | 5/8/2001 |
---|
Keywords: | kbASPObj kbDSupport kbprb kbScript kbWebServer KB284466 |
---|
|