我在多个子域中托管了一个应用程序,如
1- www.mydomain.ae
2- student.mydomain.ae
3- teacher.mydomain.ae
在Startup.Auth.cs
文件中,我添加了以下行
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/en/Account/Login"),
CookieDomain = ".mydomain.ae", /****ADDED THIS LINE***/
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
当我按下CTRL+F5
时,它可以在我的本地环境中运行,但是在实时服务器上发布并上传后,它不起作用
编辑:其他内容
我还注意到注销已重定向到主页,但未清除cookie。登录后无法注销