You can do it 2 ways, use an application variable or store the hit in a database but there is are downfalls to each.
First if you use an application variable to maintain the number of hits, that variable will only hold true until you have to restart the webserver or the webserver goes down, once it comes back up your applicatin variable that is storing the hits will revert back to 0.
You can store the hit in the database but then you have a round trip to your database to insert the hit into a table.
You would facilitate either way by doing something like this in the global.asax file:
Sub Application_Start
Application("counter") = 0
End Sub
Sub Session_Start
Application.Lock
[Set Application variable or make a call to your database here]
Applicatoin.UnLock
End Sub
"The one language all programmers understand is profanity."
|