In the above code the line that creates FormsAuthentication
ticket has an argument for specifying cookie as a persistent or non persistent
cookie. This attribute is the one that is used for "Remember Me"
option in Login pages. Include a Checkbox beneath the password textbox in the
login page and assign the Checked property of the
checkbox as the value for the above said argument.
We have completed creating a simple site with role based
forms authentication. Now when we run our application, users with admin role
can access the resources in admin section publisher section. A user with a publisher
role cannot access admin resources while he can access the Publisher section.
In the next section we will see how to use the LoginView
control to show and hide a group of controls on a page.