Re: Session variables with forms based authentication

From: matt (zz1__at__tiscali.fr)
Date: 05/07/04


Date: Fri, 07 May 2004 15:35:35 +0200

Hi,

Morten wrote:

> Hi!
>
> I've been implementing forms based authentication in a web project. It
> works pretty good. When I log on by clicking the "login" button the
> following code is executed:
>
> if (ValidateUser(strUserName,txtUserPass.Value))
...
> This as you can see sets a couple of session variables. The problem is
> that I've made it possible to use a persistent cookie so that users don't
> have to key in their credentials everytime they log in.When the cookie is
> used users are granted access immediately and the code above is not used
> and therefore the session variables are not initialized.

You can define the method "Session_OnStart" il the global.asax file that
will automatically execute needed code for cookie checking and session
variables initialization.

Hope this will help you.

Matt