ASP.net中的会话数据库无法正常工作 [英] Session database in ASP.net not working

查看:99
本文介绍了ASP.net中的会话数据库无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我们正在尝试使用负载均衡器在SQL Server 2008 r2中存储会话。我们在.net 4.0框架中开发了2个网站并创建了一个网站的DNS名称相同。当我们尝试访问这两个Web应用程序时,会话数据库创建了两行。



这两个应用程序都创建了相同的会话用户。我们想让网站在DB中分享同一个会话。我们无法在会话之间分享。



任何人都可以帮助我。



谢谢

Prashant

解决方案



 1. U1登录到app1(在DB中将插入一个新行用于存储app1会话)
2. u1登录到app2
1.检查DB中是否有任何打开的会话(您可以使用Session_Start事件)
2.如果可用,则恢复数据库会话(app1会话) )到app2申请。
3.如果不可用则启动新会话并插入db(在app1中执行相同的逻辑)

如果您有任何疑问请询问。


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

解决方案

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.


这篇关于ASP.net中的会话数据库无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆