Forms Authentication - GenericPrincipal- How to use web.config configuration

R

ryan_fagan

MSDN has good articles that explains how to use GenericPrincipal
objects with forms authentication. For instance,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT04.asp

However, in each of the examples I have seen, they do not use the
values that are specified in the web.config for forms authentication.
For instance the code below creates the cookie with an expiration of
60. I want to use the value in the web.config as configured in
FormsAuthentication. However, this information is not exposed by the
System.Web.Configuration objects or the FormsAuthentication objects.
Does anyone know a good way to access that data?

// Create the authentication ticket
FormsAuthenticationTicket authTicket = new
FormsAuthenticationTicket(
1, // version
txtUserName.Text, // user name
DateTime.Now, // creation
DateTime.Now.AddMinutes(60),// Expiration
false, // Persistent
roles ); // User data
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top