I am creating a counter for my webpage. What wan't to achieve is that every time user visits my asp.net application, it stores his data into database. I am using Global.asax and event Application_Start. Here is my code .
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
WebpageCounter.SaveVisitor(new WebpageVisitor()
{
VisitorIP = HttpContext.Current.Request.UserHostAddress,
VisitedOn = DateTime.Now
});
}
But it never stores anything into database. The function SaveVisitor has been tested and it is functional.
Any suggestions ?