Results 1 to 4 of 4

Thread: [RESOLVED] Sessions Not Working

  1. #1

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Resolved [RESOLVED] Sessions Not Working

    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

    VB Code:
    1. Session.Add(ApplicationSettings.SESSION_INFORMATION_MESSAGE, New String("Repair successfully updated.<br> Click OK to Return to Main Page"))
    2.  
    3. Session.Add(ApplicationSettings.SESSION_INFORMATION_DESTINATION, ApplicationSettings.PAGE_START)
    4.  
    5. Page.RegisterStartupScript("RedirectScript", "<script>redirectPage('http://xxx.xxx.xxx.xxx/Repairs/" & ApplicationSettings.PAGE_INFORMATION & "');</script>")

  2. #2
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    Re: Sessions Not Working

    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.

  3. #3
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: Sessions Not Working

    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.

  4. #4

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: Sessions Not Working

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width