Results 1 to 4 of 4

Thread: [RESOLVED] Session Problems

  1. #1

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

    Resolved [RESOLVED] Session Problems

    Hi there,

    I have a strange problem with Sessions at the moment.

    In my project i have a few pages a user must go through.

    On the first page it creates the object, populates some data on it, then i store the object in a session, lets call it "SESSION_MYDATA", and the user needs to go to the next page. On the page Load i get the object from the session, SESSION_MYDATA, and populate more data on it.
    Now this works fine.

    I have added a button that opens a new windows by calling some javascript.
    when this window opens and i try in the page_load to get the session,SESSION_MYDATA, but it returns nothing when it should contain the object.

    i have other pages similar to this that produce new pop up windows and they can obtain the sessions with out any trouble. except this one window.

    To add data to the session i use
    VB Code:
    1. Dim mycls As New myClass
    2. .....
    3. .....
    4. Session.item("SESSION_MYDATA") = mycls

    to get data from the session i use
    VB Code:
    1. Dim mycls As myclass
    2. mycls = Ctype(Session.item("SESSION_MYDATA"),myclass)

    in this one case mycls is nothing
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  2. #2
    Addicted Member
    Join Date
    Aug 2004
    Location
    Cape Town, South Africa
    Posts
    149

    Re: Session Problems

    As far as I know, the session object only lasts for a single browser instance. If the user closes its browser and opens another browser, the session will not exist anymore. Try passing the data through the querystring to access it in another browser.

  3. #3

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

    Re: Session Problems

    thats what i originally thought but i have already have numerous, about 10, other times in my web site that i create pop up windows and use sessions to get the data.
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  4. #4

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

    Re: Session Problems

    the issue here was the same as one i previously came accross.
    when running the web app in debug mode it automatically uses http:\\localhost

    when open new windows/popups from inside a previously existing window, these popups can use the sessions, however localhost does not recognise them.

    so when i hit F5 or play i need to change the http:\\localhost to http:\\127.0.0.1 or whatever your ip address is and it will work

    begs me to ask a question,

    how can you set IIS to use http:\\127.0.0.1 when running the application and not use http:\\localhost???
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

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