Forms authentication

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ian Walsh

    #1

    Forms authentication

    I'm using forms authentication within a C# project.

    I am using the standard code where a user attempts to access a page
    when they are not logged into the system.

    I am collecting a username / password and comparing this against a
    SQLServer to authenticate the user. This all works fine if the user
    already exist.

    I also have a create account area that is not secured on my site. I
    want to create a user and create the cookie so that the user is logged
    on automatically after account creation. At present I create a user
    and then the user needs to authenticate themselves using the login
    page.

    Any help appreciated.

    Thanks.
  • Mark MacRae

    #2
    Re: Forms authentication

    Just set the cookie expiry to whatever you want when you create the ticket.
    For example, if you want to remember their login for a month:

    DateTime expirationTime;
    expirationTime = DateTime.Now.Ad dMonths(1);
    FormsAuthentica tionTicket ticket = new FormsAuthentica tionTicket(1,
    sLoginName,
    DateTime.Now,
    expirationTime,
    bRememberLogin,
    sbRoles.ToStrin g());


    "Ian Walsh" <ianwalsh@hbosp lc.com> wrote in message
    news:6518cd3d.0 308210624.2c30c 99d@posting.goo gle.com...[color=blue]
    > I'm using forms authentication within a C# project.
    >
    > I am using the standard code where a user attempts to access a page
    > when they are not logged into the system.
    >
    > I am collecting a username / password and comparing this against a
    > SQLServer to authenticate the user. This all works fine if the user
    > already exist.
    >
    > I also have a create account area that is not secured on my site. I
    > want to create a user and create the cookie so that the user is logged
    > on automatically after account creation. At present I create a user
    > and then the user needs to authenticate themselves using the login
    > page.
    >
    > Any help appreciated.
    >
    > Thanks.[/color]


    Comment

    Working...