[英]c# Core MVC user identity / how can I save last login (via cookie)
I use the user identity in c# Core MVC - this works perfect but I want to save the lastlogin and a log if a user login via cookie ("remember me" function). 我在c#Core MVC中使用用户身份-可以完美运行,但是如果用户通过cookie登录(“记住我”功能),我想保存lastlogin和日志。
Where can I add my functionality? 在哪里可以添加我的功能?
Thanks a lot Ralf 非常感谢Ralf
if someone has the same problem. 如果有人有同样的问题。
I added in the user-model: public Nullable UserDataLastLogin { get; 我在用户模型中添加了:public Nullable UserDataLastLogin {get; set;
组; }
}
and add in the login-function if login is sucessfull 如果登录成功,并添加登录功能
user.UserDataLastLogin = DateTime.Now; user.UserDataLastLogin = DateTime.Now; _context.SaveChanges();
_context.SaveChanges(); HttpContext.Session.SetString("Loginsucess", DateTime.Now.ToString());
HttpContext.Session.SetString(“ Loginsucess”,DateTime.Now.ToString());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.