We have multiple sites deployed on IIS with some domain-like in.sbd.com, us.sbd.com where sbd.com in the main domain. All the sites are developed with .net core 3.1 version. We are using in-proc session management. Once user login, we want to check his details and redirect to the specific subdomain site. Please let me know the best way to handle this scenario. (There might be 1k subdomains configured in IIS).
Asked
Active
Viewed 758 times
1 Answers
2
Please refer to the below code segments, specifying a common domain in the Cookie.Domain property. To share cookies across apps at contoso.com
,such as first_subdomain.contoso.com
and second_subdomain.contoso.com
.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.ConfigureApplicationCookie(options =>
{
options.Cookie.Domain = ".contoso.com";
});
}
https://learn.microsoft.com/en-us/aspnet/core/security/cookie-sharing?view=aspnetcore-3.1#share-cookies-across-subdomains
Here is some related discussions.
How can I share session among subdomains in ASP.NET Core?
How can I share a session across multiple subdomains in ASP.NET?

Abraham Qian
- 7,117
- 1
- 8
- 22
-
Thanks, @Abraham. I would follow your references. – Sachan Jun 09 '20 at 22:16