Session variables are lost

Discussion in 'ASP General' started by Nils Erik Dall, Sep 19, 2006.

  1. Hi All

    I have a problem with my asp code on an iis 6.0 server on windows 2003
    web. When I redirect between to asp pages on my web-site, where pageA is
    in a different virtual directory from pageB the session variables value
    a lost. I know that it is the session ID there increases. (New session).
    If I make the same call in the same virtual directory the session
    variables is not lost. Is it some thing about different application
    pools? If sow, how can I join two or more application pools regarding
    to session variables? If not is there a none coding work around.

    N Dall
    Nils Erik Dall, Sep 19, 2006
    #1
    1. Advertising

  2. Nils Erik Dall wrote:
    > Hi All
    >
    > I have a problem with my asp code on an iis 6.0 server on windows 2003
    > web. When I redirect between to asp pages on my web-site, where pageA
    > is in a different virtual directory from pageB the session variables
    > value a lost. I know that it is the session ID there increases. (New
    > session). If I make the same call in the same virtual directory
    > the session variables is not lost. Is it some thing about different
    > application pools?


    Sort of. Multiple applications can (and usually do) use the same
    application pool.

    The different virtual directories are also different applications. Look
    at their properties in IIS Manager to see this.

    Sessions are application-specific.

    > If sow, how can I join two or more application
    > pools regarding to session variables?


    There is no way that I know of

    > If not is there a none coding
    > work around.
    >

    You will need to create your own session-state manager, perhaps using a
    database to store session settings for each user.

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Sep 19, 2006
    #2
    1. Advertising

  3. Nils Erik Dall

    Patrice Guest

    Double check this is the same web application ? If you defined an
    application at the root of each vdir this is expected as you are then in two
    different applications...

    --
    Patrice

    "Nils Erik Dall" <> a écrit dans le message de news:
    efBAby%...
    > Hi All
    >
    > I have a problem with my asp code on an iis 6.0 server on windows 2003
    > web. When I redirect between to asp pages on my web-site, where pageA is
    > in a different virtual directory from pageB the session variables value a
    > lost. I know that it is the session ID there increases. (New session). If
    > I make the same call in the same virtual directory the session variables
    > is not lost. Is it some thing about different application pools? If sow,
    > how can I join two or more application pools regarding to session
    > variables? If not is there a none coding work around.
    >
    > N Dall
    Patrice, Sep 19, 2006
    #3
  4. Patrice wrote:
    > Double check this is the same web application ? If you defined an
    > application at the root of each vdir this is expected as you are then in two
    > different applications...
    >

    Hi all

    Thanks for the replays.

    The examples mention are inside the same website.
    e.g. http://webserver/testa/pagea.asp >>
    http://webserver/testb/pageb.asp will lose it’s session variable if
    “testa” is a virtual directory or/and “testb” is a virtual directory.

    In the example “testa” and “testb” are in the default application pool.
    My question is to be precise. Can I get “testa” and “testb” to use the
    same session variable as the website?

    N Dall
    Nils Erik Dall, Sep 19, 2006
    #4
  5. Nils Erik Dall wrote:
    > Patrice wrote:
    >> Double check this is the same web application ? If you defined an
    >> application at the root of each vdir this is expected as you are
    >> then in two different applications...
    >>

    > Hi all
    >
    > Thanks for the replays.
    >
    > The examples mention are inside the same website.
    > e.g. http://webserver/testa/pagea.asp >>
    > http://webserver/testb/pageb.asp will lose it’s session variable if
    > “testa” is a virtual directory or/and “testb” is a virtual directory.
    >
    > In the example “testa” and “testb” are in the default application
    > pool. My question is to be precise. Can I get “testa” and “testb” to
    > use the same session variable as the website?
    >

    Nothing you have said changes my previous reply.

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Sep 19, 2006
    #5
  6. testa = one virtual directory
    testb = another virtual directory

    They are not the same app, even if in the same pool.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    *************************************************
    Think outside of the box!
    *************************************************
    "Nils Erik Dall" <> wrote in message
    news:efBAby%...
    > Hi All
    >
    > I have a problem with my asp code on an iis 6.0 server on windows 2003
    > web. When I redirect between to asp pages on my web-site, where pageA is
    > in a different virtual directory from pageB the session variables value a
    > lost. I know that it is the session ID there increases. (New session). If
    > I make the same call in the same virtual directory the session variables
    > is not lost. Is it some thing about different application pools? If sow,
    > how can I join two or more application pools regarding to session
    > variables? If not is there a none coding work around.
    >
    > N Dall
    Cowboy \(Gregory A. Beamer\), Sep 19, 2006
    #6
  7. Nils Erik Dall

    Patrice Guest

    Yes you can if you don't want specifically those two vdirs to be in two
    distincts applications. The boundary for a session is the web application,
    not the "web site".

    See the properties for these directories, "Virtual Directories" tab and
    "Application Settings" section. If you have defined applications on these
    directories (and it looks you have as you said that they are using the same
    pool, if they are not applications you can't define anyway separately in
    which pool they are), this is two different applications and they have as
    such each their own session.

    If they are really part of the same application, you should use then the
    "Remove" button to delete those applications (after a bit of thinking in
    case the previous setting would have been done for some reason). Those vdir
    will then be part of the same parent application and will share then the
    same session...

    --
    Patrice

    "Nils Erik Dall" <> a écrit dans le message de news:
    eQ$G2Y$...
    > Patrice wrote:
    >> Double check this is the same web application ? If you defined an
    >> application at the root of each vdir this is expected as you are then in
    >> two different applications...
    >>

    > Hi all
    >
    > Thanks for the replays.
    >
    > The examples mention are inside the same website.
    > e.g. http://webserver/testa/pagea.asp >> http://webserver/testb/pageb.asp
    > will lose it’s session variable if “testa” is a virtual directory or/and
    > “testb” is a virtual directory.
    >
    > In the example “testa” and “testb” are in the default application pool. My
    > question is to be precise. Can I get “testa” and “testb” to use the same
    > session variable as the website?
    >
    > N Dall
    Patrice, Sep 19, 2006
    #7
  8. Patrice wrote:
    > Yes you can if you don't want specifically those two vdirs to be in
    > two distincts applications. The boundary for a session is the web
    > application, not the "web site".
    >
    > See the properties for these directories, "Virtual Directories" tab
    > and "Application Settings" section. If you have defined applications
    > on these directories (and it looks you have as you said that they are
    > using the same pool, if they are not applications you can't define
    > anyway separately in which pool they are), this is two different
    > applications and they have as such each their own session.
    >
    > If they are really part of the same application, you should use then
    > the "Remove" button to delete those applications (after a bit of
    > thinking in case the previous setting would have been done for some
    > reason). Those vdir will then be part of the same parent application
    > and will share then the same session...
    >
    > --
    > Patrice
    >
    > "Nils Erik Dall" <> a écrit dans le message de news:
    > eQ$G2Y$...
    >> Patrice wrote:
    >>> Double check this is the same web application ? If you defined an
    >>> application at the root of each vdir this is expected as you are
    >>> then in two different applications...
    >>>

    >> Hi all
    >>
    >> Thanks for the replays.
    >>
    >> The examples mention are inside the same website.
    >> e.g. http://webserver/testa/pagea.asp >>
    >> http://webserver/testb/pageb.asp will lose it’s session variable if
    >> “testa” is a virtual directory or/and “testb” is a virtual directory.
    >>
    >> In the example “testa” and “testb” are in the default application
    >> pool. My question is to be precise. Can I get “testa” and “testb” to
    >> use the same session variable as the website?
    >>
    >> N Dall


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Sep 19, 2006
    #8
  9. "Cowboy (Gregory A. Beamer)" <> wrote in
    message news:...
    > testa = one virtual directory
    > testb = another virtual directory
    >
    > They are not the same app, even if in the same pool.
    >


    There is a little ambiguity here.

    testa and testb can both be virtual directory yet be part of the same app
    and share session data. I suspect in Nils case these virtual direcories
    would be also be marked as apps. In this open the directory properties and
    click remove on the home directory tab.


    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    >
    > *************************************************
    > Think outside of the box!
    > *************************************************
    > "Nils Erik Dall" <> wrote in message
    > news:efBAby%...
    > > Hi All
    > >
    > > I have a problem with my asp code on an iis 6.0 server on windows 2003
    > > web. When I redirect between to asp pages on my web-site, where pageA is
    > > in a different virtual directory from pageB the session variables value

    a
    > > lost. I know that it is the session ID there increases. (New session).

    If
    > > I make the same call in the same virtual directory the session variables
    > > is not lost. Is it some thing about different application pools? If

    sow,
    > > how can I join two or more application pools regarding to session
    > > variables? If not is there a none coding work around.
    > >
    > > N Dall

    >
    >
    Anthony Jones, Sep 19, 2006
    #9
  10. Hi All

    Thanks you all for the help. It was when I created the virtual directory
    in IIS manager, with script access, the IIS manager also make an
    individual application pool for the virtual directory in the as
    DefaultAppPool. The only ting I have to do what do remove the
    application pool again and it will use the default application pool for
    the web-site and my session variables are again global on the web-site.

    N Dall

    Patrice wrote:
    > Yes you can if you don't want specifically those two vdirs to be in two
    > distincts applications. The boundary for a session is the web application,
    > not the "web site".
    >
    > See the properties for these directories, "Virtual Directories" tab and
    > "Application Settings" section. If you have defined applications on these
    > directories (and it looks you have as you said that they are using the same
    > pool, if they are not applications you can't define anyway separately in
    > which pool they are), this is two different applications and they have as
    > such each their own session.
    >
    > If they are really part of the same application, you should use then the
    > "Remove" button to delete those applications (after a bit of thinking in
    > case the previous setting would have been done for some reason). Those vdir
    > will then be part of the same parent application and will share then the
    > same session...
    >
    Nils Erik Dall, Sep 19, 2006
    #10
  11. "Nils Erik Dall" <> wrote in message
    news:%23b$%...
    > Hi All
    >
    > Thanks you all for the help. It was when I created the virtual directory
    > in IIS manager, with script access, the IIS manager also make an
    > individual application pool for the virtual directory in the as
    > DefaultAppPool. The only ting I have to do what do remove the
    > application pool again and it will use the default application pool for
    > the web-site and my session variables are again global on the web-site.


    Ok just to be clear 'Application pool' and 'Application' are different
    things. Two different applications running in the same pool will not share
    the same session data and it is not possible to run scripts from a single
    application in two different application pools.

    What you have done is removed the _Application_, IOW you have stopped the
    virtual folder from acting as a seperate application. It therefore becomes
    part of the parents application. Application pools in this case are
    irrelevant.

    >
    > N Dall
    >
    > Patrice wrote:
    > > Yes you can if you don't want specifically those two vdirs to be in two
    > > distincts applications. The boundary for a session is the web

    application,
    > > not the "web site".
    > >
    > > See the properties for these directories, "Virtual Directories" tab and
    > > "Application Settings" section. If you have defined applications on

    these
    > > directories (and it looks you have as you said that they are using the

    same
    > > pool, if they are not applications you can't define anyway separately in
    > > which pool they are), this is two different applications and they have

    as
    > > such each their own session.
    > >
    > > If they are really part of the same application, you should use then the
    > > "Remove" button to delete those applications (after a bit of thinking in
    > > case the previous setting would have been done for some reason). Those

    vdir
    > > will then be part of the same parent application and will share then the
    > > same session...
    > >
    Anthony Jones, Sep 20, 2006
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gupta
    Replies:
    1
    Views:
    665
  2. Eliyahu Goldin

    Lost session variables - size issue?

    Eliyahu Goldin, Jan 13, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    361
    Chris Botha
    Jan 14, 2004
  3. =?Utf-8?B?TWljaGFlbCBTTA==?=

    RE: Lost Session Variables

    =?Utf-8?B?TWljaGFlbCBTTA==?=, Feb 25, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    434
    =?Utf-8?B?TWljaGFlbCBTTA==?=
    Feb 26, 2004
  4. P. Prosper
    Replies:
    2
    Views:
    473
    =?Utf-8?B?UGF1bCBI?=
    Aug 26, 2005
  5. Guns

    Session variables are lost

    Guns, Jul 16, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    429
    Alexander Widera
    Jul 16, 2005
Loading...

Share This Page