Daive
Daive

Reputation: 3

Session state are different for same domain with/without www prefix

I have Azure(C#/MVC) project which uses session state. I store sessions in Cache shared in memory of my role instances. But session state stored in http://mydomain.com and http://www.mydomain.com are different. How to fix this?

Upvotes: 0

Views: 1122

Answers (1)

Alexander Galkin
Alexander Galkin

Reputation: 12554

Even though your question is not tagged, I assume that you are using IIS for hosting your MVC project on Azure and you are using cookies for session management.

In this case you need to consolidate the domains into one in your web.config:

<httpCookies domain="mydomain.com"/>

Now both the subdomain and the main domain should have same session IDs.

Upvotes: 1

Related Questions