Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc ASP.NETMVC单点登录工作模式_Asp.net Mvc_Asp.net Mvc 3 - Fatal编程技术网

Asp.net mvc ASP.NETMVC单点登录工作模式

Asp.net mvc ASP.NETMVC单点登录工作模式,asp.net-mvc,asp.net-mvc-3,Asp.net Mvc,Asp.net Mvc 3,我正在使用ASP.NETMVC3。我的应用程序也处理域和子域的请求。Cookie对于域级应用程序和用户登录以及验证工作正常,但对于子域,它会失败 我已经尝试了域设置,即父域、计算机密钥设置。即使我启动了一个新的空应用程序进行测试,它也不起作用 已经试过了,但仍然不起作用 <authentication mode="Forms"> <forms enableCrossAppRedirects="true" name=".ASPXAUTH" /> </authe

我正在使用ASP.NETMVC3。我的应用程序也处理域和子域的请求。Cookie对于域级应用程序和用户登录以及验证工作正常,但对于子域,它会失败

我已经尝试了域设置,即父域、计算机密钥设置。即使我启动了一个新的空应用程序进行测试,它也不起作用

已经试过了,但仍然不起作用

<authentication mode="Forms">
    <forms enableCrossAppRedirects="true" name=".ASPXAUTH" />
</authentication>

cookie将子域视为单独的域。根据本文,您可以将其设置为“.mydomain.com”。注意开始时间

此链接有帮助吗?
FormsAuthentication.SetAuthCookie("tech", false);

HttpCookie cookie = FormsAuthentication.GetAuthCookie(User.Identity.Name, false);
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value);
// Store roles inside the Forms cookie.  
FormsAuthenticationTicket newticket = new FormsAuthenticationTicket(
                                                 ticket.Version, 
                                                 "aspuser",
                                                 ticket.IssueDate, 
                                                 ticket.Expiration, 
                                                 ticket.IsPersistent, 
                                                 String.Join("|", "test"), 
                                                 ticket.CookiePath
                                                 );
cookie.Value = FormsAuthentication.Encrypt(newticket);
cookie.HttpOnly = false;
cookie.Domain = "localhost";
Response.Cookies.Remove(cookie.Name);
Response.AppendCookie(cookie);