Session objects do not persist on different web pages... why that happens ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Newcomsas

    #1

    Session objects do not persist on different web pages... why that happens ?

    Hello.
    I'm rather used to include Session in my ASP classic projects and of course
    once a Session has a value assigned it is possible to retrieve it from all
    over the web site.

    This is not happening in a C# .NET project I'm working at the time. I set a
    value for 3 Sessions in a 'login' page and everything works fine (I found
    out the correct contents in the tracing informations). Problem is: when the
    user after authentication is redirected to the site's main page everything
    disappears and even in the 'Session State' section of the tracing no session
    or values are reported.

    Is there an explanation for such a behaviour ? Is there a way to make
    sessions genereted by a page readable from other pages in .NET ?

    I thank you in advance for any help

    Newcomsas


  • Mark Rae [MVP]

    #2
    Re: Session objects do not persist on different web pages... why that happens ?

    "Newcomsas" <newcomsas@hotm ail.comwrote in message
    news:gepi57$at8 $1@aioe.org...
    This is not happening in a C# .NET project I'm working at the time. I set
    a value for 3 Sessions in a 'login' page and everything works fine (I
    found out the correct contents in the tracing informations). Problem is:
    when the user after authentication is redirected to the site's main page
    everything disappears and even in the 'Session State' section of the
    tracing no session or values are reported.
    >
    Is there an explanation for such a behaviour ?
    Two possibilities spring to mind:

    1) Are the login page and the main page both in the same site / application?

    2) Is there any code which could be clearing out the Session variables, e.g.
    Session.Remove( ), Session.Abandon () etc?


    --
    Mark Rae
    ASP.NET MVP


    Comment

    • Newcomsas

      #3
      Re: Session objects do not persist on different web pages... why that happens ?

      Well, you were right, thank you. In effect I tried to delete a
      Session.Abandon row several hours ago and it didn't work.
      I repetead the operation after your post and now the Sessions appear
      correctly... By the way I also added a <sessionstate tag in the web.config.
      Probably the fact it lacked was the reason why the sessions did not work.

      "Mark Rae [MVP]" <mark@markNOSPA Mrae.netha scritto nel messaggio
      news:%23$lPRGoP JHA.576@TK2MSFT NGP06.phx.gbl.. .
      Two possibilities spring to mind:
      >
      1) Are the login page and the main page both in the same site /
      application?
      >
      2) Is there any code which could be clearing out the Session variables,
      e.g. Session.Remove( ), Session.Abandon () etc?

      Comment

      Working...