User first log and another logs. Stats for users, etc.


I will write what I have.

I have simple membership provider and login/register control. But when the new user come to site, he can sign up. After click "Finish" or "Register" button, his account is saving, but is inactivate. He also gets an email with link to active the account ( link is like:, where XXXXXX is simply his GUID number, so activating user is very easy - aproove user where userId = GUID). Ok.


But I have problem. How to make simply logger counter for each user ?

Simply: "Hello User, this is your 123 log on this portal" 

My question is about how can I easily set that when the user is logged correctly, his counter is increasing "by one" +1?

Is it the best way to save this log counter to his profile ?


And another question. How to start making a statistic engine for site ?

For now, only idea is to write a code in global.asax (OnSessionStart) that is getting simply IP,date time, etc and putting this informations to the database ? Or there is better way ?

0 Grzesiek23 12/19/2006 3:01:31 PM
Any ideas ?
0 Grzesiek23 12/19/2006 10:53:12 PM

Noone ?


0 Grzesiek23 12/20/2006 3:44:33 PM
^ Up
0 Grzesiek23 12/21/2006 4:33:18 PM
First of all you need to save the count of the access times for each user in some where, Profile properties is a good choice for this. For example:

description="SqlProfileProvider for SampleApplication" />

Note: the reason why I set the defaultValue of LogonCount to 1 is that I set CreateUserWizard.LoginCreatedUser="true".

Then in the Login.LoggedIn event you can increase the user's LogonCount by 1:

script runat="server">
protected void OnLoggedIn(object sender, EventArgs e)
ProfileCommon pc = Profile.GetProfile(Login1.UserName);

Untitled Page

OnLoggedIn="OnLoggedIn" runat="server">

Then put something like LoginView in your page to show the logon count message:

Hello World!

Text='<%# "Hello "+DataBinder.Eval(User.Identity,"Name")+", this is your "+DataBinder.Eval(Profile,"LogonCount")+" log on this portal" %>'>

Welcome to my SQL/ASPNET forum for Chinese
0 Iori_Jay 12/25/2006 7:32:06 AM

It's OK. But I have another problem with this way - when I convert login control to template and then try to log, the LoggedIn event is ignoring - I don't know why.


Can anyone help me ? 

0 Grzesiek23 4/19/2007 12:13:09 PM

I don't know why, but this works fine:


        Dim pc As ProfileCommon = Profile.GetProfile(CType(Login1.FindControl("UserName"), TextBox).Text)
        pc.LogCount += 1

0 Grzesiek23 4/19/2007 7:20:27 PM

(Thread closed)