简体   繁体   中英

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).

Where can I add my functionality?

Thanks a lot Ralf

if someone has the same problem.

I added in the user-model: public Nullable UserDataLastLogin { get; set; }

and add in the login-function if login is sucessfull

user.UserDataLastLogin = DateTime.Now; _context.SaveChanges(); HttpContext.Session.SetString("Loginsucess", DateTime.Now.ToString());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM