Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi ,

We are trying to store a session in SQL server 2008 r2 using load balancer.We have 2 websites developed in .net 4.0 framework and created a same DNS name for the web sites .When we tried to access the both web applications the session database is creating two rows.

Both applications are creating seperate sessions for the same user .We want to make the websites to share same session in DB.We are unable to share between sessions.

Can anyone help me.

Thanks
Prashant
Posted

1 solution

Hi,
Try below logic.(Two application are app1 & app2. User name is u1)
 1. U1 login to app1(In DB a new row will insert for storing app1 session)
 2. u1 login to app2
    1. Check any open session is available in DB (You can use Session_Start event for this)
    2. if available then restore DB session(app1 session) to app2 application.
    3. if not available start new session and insert into db (Do the same logic in app1)

If you have any doubt pls ask.
 
Share this answer
 
v2
Comments
Prashant Bangaluru 7-Mar-13 3:58am    
We are unable to do this can you please provide the sample code. when we searched in google, they mentioned to have the application name same in the webfarm. Do you have any idea to update the same application name for both websites.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900