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