How to Maintain Sessions between applications

Discussion in 'ASP .Net' started by Moin Syed, Sep 25, 2009.

  1. Moin Syed

    Moin Syed Guest

    Hi,

    I have two applications (websites) which are deployed in a Web farm with SQL Server as state server.Now both the websites are launched from a common page (so the session id should be same).

    When the user clicks on a particular link on one website, it needs to be redirected to the other site along with the session data. How is it possible?

    ps: The session related logic is written in another project (class library) which is common to both the websites.

    EggHeadCafe - Software Developer Portal of Choice
    WPF And The Model View View Model Pattern
    http://www.eggheadcafe.com/tutorial...b-7374d3da3425/wpf-and-the-model-view-vi.aspx
     
    Moin Syed, Sep 25, 2009
    #1
    1. Advertising

  2. On Sep 25, 8:08 am, Moin Syed wrote:
    > Hi,
    >
    > I have two applications (websites) which are deployed in a Web farm with SQL Server as state server.Now both the websites are launched from a common page (so the session id should be same).
    >
    > When the user clicks on a particular link on one website, it needs to be redirected to the other site along with the session data. How is it possible?
    >
    > ps: The session related logic is written in another project (class library)  which is common to both the websites.
    >
    > EggHeadCafe - Software Developer Portal of Choice
    > WPF And The Model View View Model Patternhttp://www.eggheadcafe.com/tutorials/aspnet/ec832ac7-6e4c-4ea8-81ab-7...


    Use StateServer mode, which stores session state in a separate process
    called the ASP.NET state service. This ensures that session state is
    preserved if the Web application is restarted and also makes session
    state available to multiple Web servers in a Web farm.

    http://idunno.org/articles/277.aspx
     
    Alexey Smirnov, Sep 25, 2009
    #2
    1. Advertising

  3. Moin Syed

    cubaman Guest

    On Sep 25, 8:25 am, Alexey Smirnov <> wrote:
    > On Sep 25, 8:08 am, Moin Syed wrote:
    >
    > > Hi,

    >
    > > I have two applications (websites) which are deployed in a Web farm with SQL Server as state server.Now both the websites are launched from a common page (so the session id should be same).

    >
    > > When the user clicks on a particular link on one website, it needs to be redirected to the other site along with the session data. How is it possible?

    >
    > > ps: The session related logic is written in another project (class library)  which is common to both the websites.

    >
    > > EggHeadCafe - Software Developer Portal of Choice
    > > WPF And The Model View View Model Patternhttp://www.eggheadcafe.com/tutorials/aspnet/ec832ac7-6e4c-4ea8-81ab-7...

    >
    > Use StateServer mode, which stores session state in a separate process
    > called the ASP.NET state service. This ensures that session state is
    > preserved if the Web application is restarted and also makes session
    > state available to multiple Web servers in a Web farm.
    >
    > http://idunno.org/articles/277.aspx


    Also, you could save state in an Sql server database if you need more
    scalability or better performance.
    http://support.microsoft.com/kb/311209
     
    cubaman, Sep 25, 2009
    #3
  4. Moin Syed

    bruce barker Guest

    session is unique by website (the siteid is part of the key), so each
    website has its own session and sessionid's.

    you will need to supply a new session manager of your own. you will need
    to change the session cookie logic to use a common domain path to store
    the sessionid, and then change the session logic to use this cookie to
    lookup session data.

    note: asp.net queues requests that access the same session, via session
    locking. you will have to be sure to implement the locking correctly.

    -- bruce (sqlwork.com)

    Moin Syed wrote:
    > Hi,
    >
    > I have two applications (websites) which are deployed in a Web farm with SQL Server as state server.Now both the websites are launched from a common page (so the session id should be same).
    >
    > When the user clicks on a particular link on one website, it needs to be redirected to the other site along with the session data. How is it possible?
    >
    > ps: The session related logic is written in another project (class library) which is common to both the websites.
    >
    > EggHeadCafe - Software Developer Portal of Choice
    > WPF And The Model View View Model Pattern
    > http://www.eggheadcafe.com/tutorial...b-7374d3da3425/wpf-and-the-model-view-vi.aspx
     
    bruce barker, Sep 25, 2009
    #4
  5. Moin Syed wrote in news::

    > Hi,
    >
    > I have two applications (websites) which are deployed in a Web farm
    > with SQL Server as state server.Now both the websites are launched
    > from a common page (so the session id should be same).


    Wrong. Session id is application specific. Or, more directly, cookie
    dependent.

    If you set the machine keys identical, and you set up the same name for
    the <forms> tag on both machines, you can share a single sign on,
    however. <more>

    > When the user clicks on a particular link on one website, it needs to
    > be redirected to the other site along with the session data. How is it
    > possible?


    Session data will have to be stored to be picked up by the other
    application. You cannot use the session variables in the other app, even
    if you set it up for single sign on. If anyone knows a way around this,
    they need to post, as I have yet to figure a way around this.

    The only way I know to share session is have all of the 'applications'
    in a single web site.

    > ps: The session related logic is written in another project (class
    > library) which is common to both the websites.


    You can persist off the values of hte objects and then reconstitute.

    peace and race,


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

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    My vacation and childhood cancer awareness site:
    http://www.crazycancertour.com

    *******************************************
    | Think outside the box! |
    *******************************************
     
    Gregory A. Beamer, Sep 25, 2009
    #5
  6. Alexey Smirnov <> wrote in
    news::


    > Use StateServer mode, which stores session state in a separate process
    > called the ASP.NET state service. This ensures that session state is
    > preserved if the Web application is restarted and also makes session
    > state available to multiple Web servers in a Web farm.
    >
    > http://idunno.org/articles/277.aspx


    Does that work across applications? I have not tried this since 1.x, so
    this is a sincere question. In 1.x, I could share a single cookie (name
    under <forms>) in multiple apps, but I could not do this:

    string foo = Session["foo"];

    Storing session in SQL server will overcome a temporary application
    stopage, so I agree with that, but one of the OPs needs was sharing
    session amongst various apps.

    Peace and Grace,


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

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    My vacation and childhood cancer awareness site:
    http://www.crazycancertour.com

    *******************************************
    | Think outside the box! |
    *******************************************
     
    Gregory A. Beamer, Sep 25, 2009
    #6
    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. Vikram Sinha
    Replies:
    0
    Views:
    432
    Vikram Sinha
    Jul 17, 2003
  2. Ken Cox [Microsoft MVP]

    Re: Relationship between IIS Sessions and ASP.NET Sessions?

    Ken Cox [Microsoft MVP], Aug 8, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    5,380
    Luther Miller
    Aug 8, 2003
  3. praba kar
    Replies:
    2
    Views:
    873
    Paul Rubin
    May 4, 2005
  4. scottymo
    Replies:
    3
    Views:
    719
    Dominick Baier
    Sep 30, 2006
  5. Bookham Measures

    Moving from ASP Sessions to Database Sessions

    Bookham Measures, Jul 23, 2007, in forum: ASP General
    Replies:
    19
    Views:
    579
    Bookham Measures
    Aug 23, 2007
Loading...

Share This Page