Tutorials to .com


ASP.NET Development Articles


Can't Find What You're Looking For?

Tutorials to .com » Dotnet » Development » Magical asp + in global.asax

Magical asp + in global.asax

Print View , by: iSee ,Total views: 30 ,Word Count: 459 ,Date: Wed, 26 Aug 2009 Time: 10:07 PM

/ *
Tofu is fine
http://www.asp888.net technical points such as tofu, reproduced Please keep this copyright information
* /
In the asp of the previous article I talked about how to implement in the asp page statistics, but such programs have such a problem is that the only statistics of individual pages, we can easily asp + implementation of the whole site Statistics in asp.net page in the original asp in the global.asa is adjusted to become one of the global.asax In addition to the previous four events were added to two events Application_BeginRequest and Application_EndRequest
These two events on the site any time a file is requested will be excited, so we took advantage of this incident to achieve access to the site statistics we first take a look at the global.asax file
<script language="VB" runat="server">
Sub Application_Start (Sender As Object, E As EventArgs)

End Sub

Sub Application_End (Sender As Object, E As EventArgs)
We piggyback realized the site's current online
dim intOnlineNumber as integer
intOnlineNumber = cInt (Application ( "ONLINENUMBER")) -1
application ( "ONLINENUMBER") = intOnlineNumber
End Sub

Sub Session_Start (Sender As Object, E As EventArgs)
Application.Lock
intOnlineNumber = cInt (Application ( "ONLINENUMBER")) +1
application ( "ONLINENUMBER") = intOnlineNumber +1
Application.UnLock
End Sub

Sub Session_End (Sender As Object, E As EventArgs)

End Sub

Sub Application_BeginRequest (Sender As Object, E As EventArgs)
This is where the
response.write ( "the current visit of the page is" + Request.FilePath + "<br>")
Now that we can get FilePAth then we just put this argument in detail a wide range of statistics could be a
End Sub

Sub Application_EndRequest (Sender As Object, E As EventArgs)

End Sub
</ script>
Well, after the end of all, we visited the site on any aspx file, will be found at the top line of text: The current visit to the page is. . . .
How, do not hurry it a try? ?


Author: tofu ()


Google
 

Rating: Not yet rated

Comments

No comments posted.