⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basepage.vb

📁 this is the code for user manager
💻 VB
字号:
Imports System.Data
Imports System.Data.SqlClient

Public Class BasePage
    Inherits System.Web.UI.Page

    Protected Sub LogActivity(ByVal action As String)
        'Only proceed if the user is authenticated
        If Request.IsAuthenticated Then
            'Get information about the currently logged on user
            Dim usr As MembershipUser = Membership.GetUser
            If usr Is Nothing Then
                'Whoops, we don't know who this user is!
                Exit Sub
            End If

            'Read in the user's UserId value
            Dim UserId As Guid = CType(usr.ProviderUserKey, Guid)


            'Call the sproc_UpdateUsersCurrentActivity sproc
            Using myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("MembershipConnectionString").ConnectionString)
                Dim myCommand As New SqlCommand("sproc_UpdateUsersCurrentActivity", myConnection)
                myCommand.CommandType = CommandType.StoredProcedure

                myCommand.Parameters.AddWithValue("@UserId", UserId)
                myCommand.Parameters.AddWithValue("@Action", action)
                myCommand.Parameters.AddWithValue("@CurrentTimeUtc", DateTime.UtcNow)

                'Execute the sproc
                myConnection.Open()
                myCommand.ExecuteNonQuery()
                myConnection.Close()
            End Using
        End If
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -