Christian de Bellefeuille
asked on
Response.Redirect doesn't work anymore
This problem drive me nuts. My code was working fine yesterday, and now i get this problem.
My main application windows open a Popup window to let the user choose for a specific event. Once the user accept, and that he entered the good authorization code for an event, the popup should close.
But right now, my "Page.Response.Redirect" in CloseWindow doesn't work anymore. It should work and just reload itself to fall into the PreInit. The PreInit should see "close" as action, then close. But nothing happen after Redirect... it doesn't reload or preinit.
Any idea?
I thought i caused this problem by adding a "virtual directory" to my application instead of having only "/", but i removed that and i still have the problem.
I've tried to put my page.response.redirect into a try-catch bloc, but it doesn't work and give me "Thread was being aborted" error, which is normal...
PLEASE, HELP!
My main application windows open a Popup window to let the user choose for a specific event. Once the user accept, and that he entered the good authorization code for an event, the popup should close.
But right now, my "Page.Response.Redirect" in CloseWindow doesn't work anymore. It should work and just reload itself to fall into the PreInit. The PreInit should see "close" as action, then close. But nothing happen after Redirect... it doesn't reload or preinit.
Any idea?
I thought i caused this problem by adding a "virtual directory" to my application instead of having only "/", but i removed that and i still have the problem.
I've tried to put my page.response.redirect into a try-catch bloc, but it doesn't work and give me "Thread was being aborted" error, which is normal...
PLEASE, HELP!
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Request.QueryString.Get("action") <> "close" Then
' Reset some Session variable
Session("EVENT_DESC") = ""
Session("EVENT_TYPE_KEY") = -1
End If
End Sub
Private Sub btnAccept_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAccept.Click
' Some code here assign nEventKey according to what's found in the database
' If we found the item in the database, we can close the window
If nEventKey <> -1 Then
CloseWindow()
End If
End Sub
Private Sub CloseWindow()
Page.Response.Redirect("ChooseEvent.aspx?action=close")
End Sub
Private Sub ChooseEvent_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
If Request.QueryString.Get("action") = "close" Then
BodyTag.Attributes.Add("onload", "javascript:(window.close())")
BodyTag.Attributes.Add("onunload", "opener.location='Calendrier.aspx';")
End If
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
haha. well, the important thing is you got it fixed.