简体   繁体   English

单个域ASP.Net下的应用程序之间的会话共享

[英]Session sharing between applications under single domain ASP.Net

We are using sql server for session state and here is the web.config entry: 我们将sql server用于会话状态,这是web.config条目:

<sessionState mode="SQLServer" allowCustomSqlDatabase="true" sqlConnectionString="data source=MyServer;Initial Catalog=MyDatabase;user id=user;password=password" cookieless="false" timeout="20" />

We have a custom MVC site and a CMS site, both are independent projects and on dev, staging and prod, CMS site is setup as an "application" under MVC site. 我们有一个自定义的MVC站点和一个CMS站点,它们都是独立的项目,并且在开发,登台和生产中,CMS站点都设置为MVC站点下的“应用程序”。 MVC site is the root. MVC网站是根。

Our urls look like: 我们的网址看起来像:

http://www.domina.org (prod, load balanced, multiple servers) http://staging.domain.org (staging, load balanced, multiple servers) http://development.NAME-hq.local (development) http://www.domina.org (产品,负载均衡,多台服务器) http://staging.domain.org (设备,负载均衡,多台服务器) http://development.NAME-hq.local (开发)

and CMS site urls are: 和CMS网站网址为:

http://www.domina.org/core (prod, load balanced, multiple servers) http://staging.domain.org/core (staging, load balanced, multiple servers) http://development.NAME-hq.local/core (development) http://www.domina.org/core (产品,负载均衡,多台服务器) http://staging.domain.org/core (设备,负载均衡,多台服务器) http://development.NAME-hq。本地/核心 (开发)

Local development, my session is not shared since i am using built in web server and port numbers are different for both the projects. 本地开发,我的会话未共享,因为我使用的是内置的Web服务器,并且两个项目的端口号都不同。

My session is not getting shared on development site between MVC and CMS sections. 我的会话没有在MVC和CMS部分之间的开发站点上共享。 however, staging and production share the session without any problem. 但是,阶段和生产共享会话没有任何问题。 Is it due to the way our name is for the dev site? 是因为我们的名称用于开发站点的方式吗? Should i get it changed to something like dev.domain.com? 我应该将其更改为dev.domain.com之类的东西吗?

If you're using ASP.NET 2.0 or greater you should be able to just use <httpCookies httpOnlyCookies="true"/> in your web.config. 如果您使用的是ASP.NET 2.0或更高版本,则应该可以在web.config中使用<httpCookies httpOnlyCookies="true"/>

Here is the MSDN Article http://msdn.microsoft.com/en-us/library/ms228262(v=vs.80).aspx 这是MSDN文章http://msdn.microsoft.com/zh-cn/library/ms228262(v=vs.80).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM