PDA

Click to See Complete Forum and Search --> : [RESOLVED] Sessions Not Working


Strider
Feb 23rd, 2005, 07:14 AM
When i use some javascript code embedded in a Page.RegisterStartupScript to redirect a page, the new page does not seem to identify the sessions that i try to assign to values on that page


Session.Add(ApplicationSettings.SESSION_INFORMATION_MESSAGE, New String("Repair successfully updated.<br> Click OK to Return to Main Page"))

Session.Add(ApplicationSettings.SESSION_INFORMATION_DESTINATION, ApplicationSettings.PAGE_START)

Page.RegisterStartupScript("RedirectScript", "<script>redirectPage('http://xxx.xxx.xxx.xxx/Repairs/" & ApplicationSettings.PAGE_INFORMATION & "');</script>")

token
Feb 23rd, 2005, 08:34 AM
I am sure someone can correct me if I am wrong but i believe that session variables do not get populated unless you post back to the server.

I believe having a similar problem and I ended up finding a different way to do things. Though this was with user defined session variables so I could be wrong.

nemaroller
Feb 23rd, 2005, 12:27 PM
Well, first, it sounds like you are telling the user something was displayed, then they click OK, at which point they get redirected.

So - perhaps you don't want RegisterStartupScript rather RegisterClientScriptBlock - I don't know for sure because I don't know the functionality you require. Startup runs before the page finishes loading in most cases.

Session should be ok otherwise - I would check the field names your passing PAGE_START, PAGE_INFORMATION ... be sure they contain the appropriate values.

Strider
Feb 24th, 2005, 03:28 AM
What i am trying to do it on the page they click on a button then it will open a new window and the old page will redirect back to the mainpage again.

Can you tell me more about the RegisterClientScriptBlock and how to use it