The web system developed by asp.net records the method page of simple LOG (when and when the user accessed the page and clicked the button). Effect: related code: ''' <summary> ''' initially ''' </summary> ''' <param name = "sender"> </param> ''' <param name = "e"> </param> ''' <remarks> </remarks> Protected Sub Page_Load (ByVal sender As Object, byVal e As System. eventArgs) Handles Me. load... 'Write operation log LogInfo. writeLogInfo (Me) End Sub Public Shared Sub writeLogInfo (ByVal myPage As System. web. UI. page) Dim userID As String Dim userName As String Dim keyDateTime As String Dim kb As String Dim formID As String Dim formName As String Dim buttonID As String Dim buttonName As String Dim c As WebControls. button Dim iIndex As Integer Try userID = CType (myPage. session (ConstantInfo. SESSION_USER_INFO_CONST), UserInfoEntity ). userID userName = CType (myPage. session (ConstantInfo. SESSION_USER_INFO_CONST), UserInfoEntity ). userName keyDateTime = Format (Now, "yyyy-MM-dd HH: mm: ss") If Not myPage. isPostBack Then kb = "1" 'image iIndex = myPage. appRelativeVirtualPath. lastIndexOf ("/") If iIndex <>-1 Then formID = myPage. appRelativeVirtualPath. substring (iIndex ). replace ("/", "") Else formID = myPage. appRelativeVirtualPath End If formName = myPage. title buttonID = "-" buttonName = "" 'insert into the LOG table insertLogTable (userID, userName, keyDateTime, kb, formID, formName, buttonID, buttonName) else kb = "2" 'button iIndex = myPage. appRelativeVirtualPath. lastIndexOf ("/") If iIndex <>-1 Then formID = myPage. appRelativeVirtualPath. substring (iIndex ). replace ("/", "") Else formID = myPage. appRelativeVirtualPath End If formName = myPage. title c = getPostBackControlID (myPage) If Not c Is Nothing Then buttonID = c. ID buttonName = c. text 'insert into the LOG table insertLogTable (userID, userName, keyDateTime, kb, formID, formName, buttonID, buttonName) end If Catch ex As Exception 'do nothing End Try End Sub Private Shared Function getPostBackControlID (ByVal myPage As System. web. UI. page) As WebControls. button Dim ctrl As Control = Nothing Dim ctrlName As String = myPage. request. params ("_ EVENTTARGET") If Not ctrlName Is Nothing AndAlso Not ctrlName. equals ("") Then ctrl = myPage. findControl (ctrlName) Else Dim ctrlStr As String = "" Dim c As Control = Nothing For Each ctl As String In myPage. request. form If ctl. endsWith (". x ") OrElse ctl. endsWith (". y ") Then ctrlStr = ctl. substring (0, ctl. length-2) c = myPage. findControl (ctrlStr) Else c = myPage. findControl (ctl) End If TypeOf (c) Is System. web. UI. webControls. button Then ctrl = c Exit For End If Next End If Return ctrl End Function