I'm new in mvc 4 and can't understand exactly how simple membership worked. After all configuration I put this code to AccountController to see how it works and is it work at all
string UserName1 = WebSecurity.CurrentUserName;
bool LoginResult= WebSecurity.Login("admin", "111111");
string UserName2 = WebSecurity.CurrentUserName;
WebSecurity.Logout();
And when I run debugger I see that after all finished
UserName1 = ""
LoginResult = true
UserName2 = ""
Everything is ok except UserName2. Why it is empty? Login was sussess... Also I can't see UserID at WebSecurity and WebSecurity.IsAuthentificated is false Why login was successful but WebSecurity do not shows it at all?