當有人登錄我的應用程序,他們檢查了「記住我」複選框時,我設置了createPersistentCookie = true
,以便當他們回來時不需要再次登錄。然而,有時候我需要使用FormsAuthentication.SetAuthCookie(NewUserName, [true/false])
,所以我怎麼知道它們是否最初將createPersistentCookie
設置爲true,所以我可以保持它與登錄時相同?如何在ASP.NET窗體身份驗證中檢查「createPersistentCookie」?
1
A
回答
2
我相信,當你解密cookie時,你應該留下一個FormsAuthenticationTicket
,然後你可以查詢IsPersistent
屬性。
要解密:
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value);
1
您應該還記得在你的應用程序的web.config恆定值來設定。 ASP.NET有一段時間後會自動生成這個值的趨勢。
欲瞭解更多信息,請看看:http://msdn.microsoft.com/en-us/library/w8h3skw9(v=VS.90).aspx
相關問題
- 1. Asp.net身份驗證檢查
- 2. ASP.NET窗體身份驗證Cookie在Safari
- 3. 如何從asp.net窗體身份驗證轉換爲Windows身份驗證
- 4. 使用窗體身份驗證在ASP.NET Web窗體中路由
- 5. ASP.NET窗體身份驗證與Windows Safari
- 6. ASP.NET窗體基於身份驗證
- 7. asp.net窗體身份驗證腳本
- 8. ASP.NET窗體身份驗證到期
- 9. 窗體身份驗證asp.net VB
- 10. ASP.NET窗體身份驗證+ NTLM + LDAP
- 11. ASP.NET窗體身份驗證漏洞
- 12. ASP.NET窗體身份驗證 - 多登錄
- 13. ASP.NET窗體身份驗證Cookie
- 14. 窗體身份驗證ASP.Net失敗
- 15. ASP窗體身份驗證
- 16. Uploadify - 窗體身份驗證
- 17. 窗體身份驗證
- 18. ASP.NET身份+ Windows身份驗證(混合模式 - 窗體+ Windows)
- 19. ASP.NET窗體身份驗證身份驗證cookie始終是持久性的
- 20. Windows身份驗證和窗體身份驗證一起用於ASP.NET
- 21. ASP.NET窗體身份驗證和「無身份驗證」子文件夾
- 22. ASP.NET窗體身份驗證和持久性身份驗證Cookie安全
- 23. ASP.NET窗體身份驗證下游WCF身份驗證和授權
- 24. 路由與ASP.NET Web窗體與窗體身份驗證
- 25. 從窗體身份驗證轉換爲Windows身份驗證
- 26. 網站窗體身份驗證 - > SQL Server Windows身份驗證
- 27. 基本身份驗證,回退到窗體身份驗證
- 28. 如何ASP.NET窗體身份驗證的工作:從要求
- 29. 如何獲取enableCrossAppRedirects與窗體身份驗證asp.net工作?
- 30. 我如何檢查gmail身份驗證?
正是我所需要的,謝謝! – Darryl 2013-04-07 13:38:39