Reputation: 693
I am working with a .Net(VB.Net) project. I need to keep track of the pages that my users keep visiting. For example i have some users say
Userid Username
1 Pravin
2 James
3 Daniel
I have some pages in my project say
Page1.aspx,
Page2.apsx
Page3.aspx..
like this..
I want to keep track which user accessed which page with the number of times visited each day and save it in a table of sqlserver.
Please help me out in this context..
Upvotes: 1
Views: 2476
Reputation: 17614
I think what you are looking is Application_BeginRequest
Fired when an application request is received. It's the first event fired for a request, which is often a page request (URL) that a user enters.
Note that this event is fired for every request(Images, css, java-scritp ...)
you need to check for .aspx
extenstion
I think finding user will be difficult on BeginRequest
you can use Application_AuthenticateRequest
for that purpose.
void Application_PreRequestHandlerExecute(object sender, EventArgs e)
{
var page = (Context.Handler as System.Web.UI.Page);
}
Here is more details about that event
.NET Application_BeginRequest - How to get User reference?
Upvotes: 1