Below is the code used to login
WebSecurity.Login("abc", "123", true);//return true
return RedirectToAction("afterLogin", @"afterLogin");
After loggin in, I checked the user's id to see if it's -1 by running the below line:
WebSecurity.CurrentUserId
But why whenever I called this, the return value always -1 and CurrentUserName
is empty?
edited:
An additional question:
Does the WebSecurity
have something like timeout so that the user idle for a specific period and will logged out automatically?