Re: Best way to check for first Login
- From: "JJ" <abc@xxxxxxx>
- Date: Fri, 22 Sep 2006 18:08:47 +0100
As I had no reaponses I guess I was either on the wrong tracks totally, or
no one had a work around.
In the end, I added extra properties to the users profile and checked those
upon logging in (i.e. I didn't use the onAuthenticate event at all)
JJ
"JJ" <abc@xxxxxxx> wrote in message
news:OzjXfAi3GHA.2228@xxxxxxxxxxxxxxxxxxxxxxx
I am comparing the 'lastloggedin' and 'createddate' fields of the
membership table to see if this is the first time the user has logged in.
(if they are within 1 second on each other I presume this is the first
login).
I have worked out that I can't check for this in the 'onLoggedIn' event,
as this is after the 'lastloggedin' field is updated. So, I am trying to
do the check in the 'onAuthenticate' event.
However, when I add this handler I stop the authentication taking place.
How do I let authentication take place normally whilst still running my
extra code?
Or, is there another way to check for first login?
JJ
i.e.:
protected void OnAuthenticate(object sender, AuthenticateEventArgs e)
{
string thisUsername =
((System.Web.UI.WebControls.Login)(sender)).UserName;
DateTime CreatedDateTime = Membership.GetUser(thisUsername).CreationDate;
DateTime LastLoggedInDateTime =
Membership.GetUser(thisUsername).LastLoginDate;
System.TimeSpan TimeDiff = LastLoggedInDateTime.Subtract(CreatedDateTime);
//Probably only need 2 seconds max
if (TimeDiff.TotalSeconds < 2)
{
//this is first login
FirstLogin = true;
}
}
.
- References:
- Best way to check for first Login
- From: JJ
- Best way to check for first Login
- Prev by Date: Directory structures different on development machine vs. install machine.
- Next by Date: Re: Menu Control - current node
- Previous by thread: Best way to check for first Login
- Next by thread: Sax-Based Xml Pipelining Framework for .Net? (Cocoon for .Net)
- Index(es):
Relevant Pages
|