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

Discussion in 'ASP .Net Security' started by ryan_fagan, Sep 9, 2003.

  1. ryan_fagan

    ryan_fagan Guest

    MSDN has good articles that explains how to use GenericPrincipal
    objects with forms authentication. For instance,

    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
    1, // version
    txtUserName.Text, // user name
    DateTime.Now, // creation
    DateTime.Now.AddMinutes(60),// Expiration
    false, // Persistent
    roles ); // User data
    ryan_fagan, Sep 9, 2003
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.