![](/img/trans.png)
[英]Why call SignOut(DefaultAuthenticationTypes.ExternalCookie) before use of ApplicationCookie with ASP.Net Identity?
[英]DefaultAuthenticationTypes.ApplicationCookie persist after server reboot
我正在使用mvc 5與facebook進行外部登錄,但每次重啟服務器后,用戶都將退出系統。 這違背了oAuth的目的? 我找不到任何屬性,讓它們通過重新啟動持續存在
這就是startup.auth的樣子......
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/External"),
ExpireTimeSpan = new TimeSpan(30, 0, 0, 0),
SlidingExpiration = true
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
是的,所以相當於記住我的密碼登錄不是默認模板中的一個選項,基本上你可以通過在ExternalLoginCallback中將isPersistent更改為true來做到這一點
await SignInAsync(user, isPersistent: false);
如果web.config
文件使用默認的自動生成設置,則每次Web服務器重新啟動時,服務器的加密密鑰都將更改。 要解決此問題, machineKey
元素需要具有固定的鍵值。
在線machineKey
生成器: http : //aspnetresources.com/tools/machineKey
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.