Forms based authentication in ASP.NET is quite useful. Instead of writing our own authentication processes we can simply change the web.config beneath system.web like so.... * The authentication mode is set to Forms. * A URL is...
See more »
Forms based authentication in ASP.NET is quite useful. Instead of writing our own authentication processes we can simply change the web.config beneath system.web like so.... * The authentication mode is set to Forms. * A URL is provided so that ASP.NET knows where to redirect people who need to log in. * A timeout is specified in minutes. This is "time since last request" not the "time since login". If a login is indicated to be persistent (described later) this is ignored. * A protection method is specified for the cookie. Next I wanted to specify a folder to which access is restricted to people who have logged in. To do this I entered the following code in the web.config file (beneath )... This tells ASP.NET that the path "/Members" (the lead / is always implied) should deny access to all unknown users. When someone tries to access a page in /Members they will instead be redirected to the login.aspx URL you specified in web.config. This Login.aspx form should ask for whatever credentials you want (username/password for example) and validate them. Once they have been validated you only need to execute the following code to have the user redirected back to the page they were originally trying to access... System.Web.Security.FormsAuthentication.RedirectFromLoginPage(userId, false); The userId is the unique identifier for the current user (username), and the second Boolean parameter indicates whether this should be a persistent security cookie, or a temporary one (with expiry since last page request), as mentioned earlier.
See less »
Kaboodle will send you a newsletter and updates from your friends. You can unsubscribe at any time. Kaboodle does not sell or share your email address or personal information with anyone.
Kaboodle requires all users to provide their real date of birth as both a safety precaution and as a means
of preserving the integrity of the site. You will be able to hide this information from your profile if you wish.
Added by 1 people