我有一個MVC站點在apache2 undo ubuntu上運行在單聲道2.10.8.1上。我有一個服務,檢查憑據和設置cookie,如果一切正常。在Windows中,我沒有問題,只有一個cookie:.ASPXAUTH
。但是,當我部署到Linux服務器,它設置兩個餅乾ASP.NET_SessionId
和.MONOAUTH
。Linux上的單聲道返回不同的Cookie集
我的問題是爲什麼它是兩個餅乾在Linux和一個在Windows中,我怎麼能擺脫ASP.NET_SessionId
餅乾?
我設置的cookie這樣的:
Response.AppendCookie(BuildAuthenticationCookie(login, data));
public static HttpCookie BuildAuthenticationCookie(string login, string ticketData)
{
var authTicket = new FormsAuthenticationTicket(2, login, DateTime.Now,
DateTime.Now.AddMinutes(500), false, ticketData);
var authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(authTicket))
{
HttpOnly = true,
Secure = SiteSettings.CookiesSslOnly,
Expires = DateTime.Now.AddMinutes(SiteSettings.AuthCookieExpirationTime)
};
return authCookie;
}
嗯,我想沒有錯的單聲道,我相信它使用它自己的cookie機制。在窗戶方面,我想我有相同的兩個餅乾(我使用相同的動作),但ASP.NET在一個餅乾中合併。謝謝你,這是有用的 – Felix
我不想關閉洞應用程序的會話,但我有一些控制器扮演一個Web服務角色,我不需要他們的會話。我想有沒有辦法(一個好辦法)讓會議關閉僅適用於部分應用:) – Felix
小心!微軟的ASP.NET棧不會爲SessionState和Authorization使用一個cookie。這些在ASP.NET中完全分離!查看http://stackoverflow.com/questions/6066554/is-there-any-good-reason-why-the-authentication-cookie-and-the-session-state-coo瞭解更多信息。 –