I installed a standard ASP.NET MVC site with basic authentication. I added roles, so new users get a specific role.
Now I want you to be able to personalize the user.
Outstanding Advice
The personification when searching around is as follows:
FormsAuthentication.SetAuthCookie(user.UserName, false);
This does not work by default, since you need to do two things:
1
Enable Authentication:
<system.web>
<authentication mode="Forms" />
</system.web>
2:
Unplug the module:
<system.webServer>
<modules>
</modules>
<staticContent>
Task
However, doing this leaves a few problems.
- When you personify yourself, you cannot log out. This is easily fixed by adding the following to LogOut:
FormsAuthentication.SignOut();
User.IsInRole(Constants.Roles.Creditor);
stops working, so we can’t check if the user is in the role
What to do?
- , - , . , ?
"Forms", , , "". , :
?: -)