0
我正在使用ASP.Net MVC 3.我的应用程序也处理对域和子域的请求。对于域级应用程序以及用户登录和验证,Cookie工作正常,但对于子域而言,它会失败。ASP.Net MVC单一登录正在工作
我已经尝试过域设置i-e父域,机器密钥设置。即使我开始了一个新的空测试应用程序,它不起作用。
已经尝试过,但仍然无法正常工作。
<authentication mode="Forms">
<forms enableCrossAppRedirects="true" name=".ASPXAUTH" />
</authentication>
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);
我已经测试了它,它不工作 – 2011-05-24 10:42:43
这是否链接帮助任何? http://stackoverflow.com/questions/608120/forms-authentication-across-sub-domains – Kenoyer130 2011-05-24 10:49:19