Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用 WebSecurity.Login 方法启用了确认功能,一切正常,当用户尚未确认他的帐户但它未能按预期登录但我怎么知道为什么会发生失败?
我想区分由于用户名/密码错误导致的失败和由于未经确认的帐户而导致的失败,但登录方法仅返回布尔值
只需在登录前添加此检查
if (!WebSecurity.IsConfirmed(userName)) ModelState.AddModelError("", "The Account is not confirmed yet!");