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 ?

12/19/2006 3:01:31 PM 27051 articles. 1 followers. Follow

6 Replies

Similar Articles

[PageSpeed] 23
Get it on Google Play
Get it on Apple App Store

Any ideas ?
12/19/2006 10:53:12 PM

Noone ?


12/20/2006 3:44:33 PM
^ Up
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:
<profile automaticSaveEnabled="true" enabled="true" defaultProvider="SqlProvider">
<clear />
<add name="SqlProvider"
description="SqlProfileProvider for SampleApplication" />

<add name="LogonCount" defaultValue="1" type="System.Int32"/>

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);
<html xmlns="" >
<head runat="server">
<title>Untitled Page</title>
<form id="form1" runat="server">
<asp:Login ID="Login1" DestinationPageUrl="~/default.aspx" OnLoggedIn="OnLoggedIn" runat="server"></asp:Login>



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

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
<html xmlns="" >
<head runat="server">
<title>Hello World!</title>
<form id="form1" runat="server">
<asp:LoginStatus ID="LoginStatus1" runat="server" >
<asp:LoginView ID="LoginView1" runat="server">
<asp:Label runat="server" ID="lable1" ForeColor="red" Text='<%# "Hello "+DataBinder.Eval(User.Identity,"Name")+", this is your "+DataBinder.Eval(Profile,"LogonCount")+" log on this portal" %>'></asp:Label>
<br />

Welcome to my SQL/ASPNET forum for Chinese
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 ? 

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

4/19/2007 7:20:27 PM

Similar Artilces:

Logging in a user onto one site logs out a user on another!
I am building a CMS application. All is on one computer during development using Visual Web Developer 2008 Express Edition and Windows XP Professional. Simply, I have one set of pages and each website's domain name points to the same pages, which load different data from the database, depending on the domain name. I am using the membership and roles framework but have left the applicationName blank in the roleManager and membership providers so that, as authenticated users create an account, a different applicationID is created for each domain name.  This way, the users and roles ...

Web page not detecting a logged in user/user not logging in
Hey guysAs it stands, I've created two web pages within my app. One is a login page which is simply a blank page with the login control dragged on top. Within this control I redirect to my second page which contains a set of asp:Panels that are supposed to hide/display depending on which user is browsing the page.I've read several tutorials and at the moment, I've installed memberships/roles using the aspnet_regsql application. I've also used the web administration tool to create an 'administrators' role and create a user which is assigned to that role. I've also ...

User Log in Log
I need to keep a daily record of network logins Being Auditcon does not work with NW6, is there a way I can enable Logging on a server/tree to capture user login? Install NSURE Audit. Configure it to record logins and out for both the server and eDir. The Nsure Audit starter pack 1.0.3 is downloadable from the website. ~+~^~+~^~+~^~+~^~+~^~+~^~+~^~ Jim Gosney Netware/Groupwise Admin./Eng. Genesco, Inc. Nashville, TN Currently reading: fiction: Lord of the Rings: Return of the King -- J.R.R. Tolkien non-fiction: George Washington -- James Burns and Susan Dunn rel...

Users logging in as the same user..
HI there.. I have a problem with ASE12.0 .. I have created 10 users on the database and granted everybody permissions and all.. However, it seems everybody, no matter who logs in, logs in as the same user.. For eg... I have user logins John, Alex, Alan, Steve......etc etc And i created a user group for all of them (eg developers..) However, when they log on to isql, anything that they do will be under John, no matter if it is logins John, Alex, Steve... or etc etc.. If i do a sp_who.. all the connections will be listed as John. If they create tables, all table created will ...

User logs in, loads another users profile.
I hope i'm posting in the correct place, I'm not sure if this is an AD issue or a Novell client issue, or ConsoleOne. User A logs into windows XP with the correct user name and password, it logs him in but loads User B's profile. Both users have never logged into the computer so it's not loading a cached profile, it always loads users B's profile, doesn't matter which computer. If user B logs in it is fine. I checked both users profiles in AD and ConsoleOne and all seems to be set correctly. We do not use roaming profiles, nor do we use terminal se...

Log in another website from the website the user logged in already
Hey guys, I hope anyone can help me out. If the user log in the website1, when clicking the link, the user will be redirected to another website2 skipping the authentication process. Otherwise, the user will have to enter userid and password to log in. Any ideas?  I can do it! Pass the context information (maybe encrypted) to the next site to automatically authenticate the user. Kinda MS Passport."look ma' no hands!"kpeguero hi kpeguero,  The question is how can i do the automatic authentication. Can you explain more details? The sample solution or any refer...

Login Control logs user in, but User is not authenticated, but user really is!
I am using aspnetmembershipprovider.  Everything works fine.  I slap a login control on my login page and am able to login and get to my secure folder etc.  When I try and put some code in the LoggedIn method "User.Identity.IsAuthenticated" = false, yet if I blow through that, I am logged, authenicated etc.  The documentation says that the LoggedIn event is "after the user is authenticated".  Any Ideas what is up?Thanks,TPS------------------------------------------------------Note Collaboration for your next confernce call. I am...

user log in log file
If I open GroupWise Client, it is logged into the poa log even before I put password information. How can I ensure that the user loged in (or didn't) in that time that log shows? Thankyou in advance. -- Fabio Martins OS/CN Analyst What exactly do you mean? If you mean "can I know if they actually succeeeded in logging in", no. imagine 3 possbilities user logs in correctly user has bad password user just cancels 1 and 3 look identical. 2 will give an FFFF error. "Fabio Martins" <>...

User logged in (and logged in on all pages)
Hello, If i get a user to log in, after entering there username and password, when they go to other pages, how do i keep them logged in??? like this site, it says at the top, logged in as:Breenan, and cant see my username in the url address bar.... Any help???? Thanks again. There are many ways to store state information besides in a querystring (which shows up in the address bar)... One common one is a Session variable which acts like a global variable for the entire application. The name could also be gotten from the database, every time the page loads, or it coul...

Redirecting a user after a user is logged in?
I am using the Login control to login a user. But I have the IsAuthenticated property of Identity object as false even after user has logged in, in Login_LoggedIn event. Also, I cannot get roles for the user in this event using Roles.GetRolesForUser. Can someone tell me how I could redirect a user based on user's role (only one role is there in my app per user) when using Login control?sun21170 Have a look into this link Hope this will help youAshok Rajawww.iGold.inDon't forget to click "Mark...

Serious issue: parts of pages render as if the user is logged in, parts render as if the user isn't logged in
'm having a very difficult time with some of our new pages. We've moved to a web farm, and it seems in spurts it will come where parts of my page think the user is logged in, and parts think the user is not logged in. It seems to happen to an entire control. (None of the controls have OutputCache set) For example, our login control on top will appear showing the user is logged inw hen they have been redirected to RegNewUser, but RegNewUser will display instead of redirecting as if the user were actually logged in. The MachineKey option in the web.config is set to a generated SHA1, s...

User object (System.Security.Principal.IPrincipal) in my web service does not reflect currently logged on user.
I am using Forms authentication, 3.5 framework. I am calling a web method from a web form page; here is my problem: For some reason the User object (System.Security.Principal.IPrincipal) in my web service does not reflect currently logged on user. I know I am logged in correctly when I call the web service method (which I call using BeginX...X()). The weird thing is, I have other services whos methods DO reflect the currently logged in user (although these are called using AutoComplete extender, don't know why one works and the other does not).Please help  http://www.geneangelo...

Do not want to log in user after user is created
Hi there, By default, the aspnet membership create user wizard automatically log in user once the account is created. What is the way to bypass that? The scenario is, a current logged in admin is creating a new account and I want the admin to stays logged in instead of the newly created user.  set property LoginCreatedUser="False" of CreatUserWizard/GuruBhai Thanks guru_sarkar. I totally missed that ...

All users are logged off when one user loggs off
I have an application developed with ASP.NET and VB.NET now i am facing a very big problem.That is when in application if anyone user does signout all users who have logged in are also signed out.This means that if 1000 users are logged in and one loggs off then all other 999 users are also logged off. This is a tedious problem and i need it to be solved as soon as possible.Please help me out as soon as possible if you have any kind of solutions.   Hi Could you post more details especially what is the solution in your code and what is your authentication setting in IIS?Best...

Web resources about - User first log and another logs. Stats for users, etc. -

Great Ocean Road fire: Number of homes lost in Christmas Day blaze rises to 116
The number of properties lost in the Christmas Day bushfire along Victoria's Great Ocean Road rises to 116.

J&K: Mufti Sayeed, separatists welcome Narendra Modi's Pak visit
In a statement, Chief Minister Mufti Mohammad Sayeed said he was delighted by Narendra Modi’s visit and added that the development would strengthen ...

Rihanna Fans Aren’t Having A Merry Christmas As ‘Anti’ Isn’t Released
Rihanna’s new album may be the most postponed one this decade. Her album campaign started off well with the hit “ FourFiveSeconds ,” a duet with ...

Top Syrian Rebel Killed in Airstrike Near Damascus
Washington Post Top Syrian Rebel Killed in Airstrike Near Damascus New York Times BEIRUT — One month before peace talks are scheduled to begin ...

89 people injured as 6.9-magnitude earthquake hits Pakistan
IBNLive 89 people injured as 6.9-magnitude earthquake hits Pakistan Hindu Business Line At least 89 people were injured in Pakistan today ...

Iraqi Forces Advance Into The Heart Of Ramadi, Abadi Eyes Mosul As Next Target
In a move likely to assist in rehabilitating the heavily compromised reputation of the Iraqi military, Iraqi forces with US air support are successfully ...

Gigi Hadid Celebrates White Christmas with Family
Gigi Hadid celebrates a dreamy white Christmas atop snow slopes with her family – mom Yolanda Foster , sister Bella Hadid , and brother Anwar ...

Oops: UK astronaut Tim Peake calls wrong number from space
Anyone can dial a wrong number, but it's not often done from outer space.

Radiohead's James Bond Theme Song "Spectre" Released
Radiohead just released a new song! “Last year we were asked to write a theme tune for the [James] Bond movie Spectre ,” Radiohead singer Thom ...

Steam shows other people's user data, but it wasn't a hack
Valve's Steam service is back up and running as expected, after a bug saw it give users a look at others' details. The high-profile error was ...

Resources last updated: 12/26/2015 9:34:37 AM