global.asax

来自「一个报税管理系统AJAX第二版B-S.rar」· ASAX 代码 · 共 48 行

ASAX
48
字号
<%@ Application Language="VB"  %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="system.configuration" %>
<%@ Import Namespace="System.Web.Configuration" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="system.configuration" %>
<script runat="server">

        Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
                ' 在应用程序启动时运行的代码
        End Sub
    
        Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
                ' 在应用程序关闭时运行的代码
        End Sub
        
        Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
                ' 在出现未处理的错误时运行的代码
        End Sub

        Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
               
        End Sub

        Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
                ' 在新会话启动时运行的代码
                Dim conn As New SqlConnection()
                conn.ConnectionString = WebConfigurationManager.ConnectionStrings("aaConnectionString").ConnectionString
                conn.Open()
                Dim strSQL As String = "delete from using where usrname='" & Session("using") & "'"
                ' MsgBox(Session("using") & "连接超时,请重新登陆", 0, "")
                Dim tran1 As SqlTransaction = conn.BeginTransaction()
                Dim sql As New SqlCommand(strSQL, conn, tran1)
                sql.ExecuteNonQuery()
                Try
                        tran1.Commit()   '确认事务 & Session("using") & "'
                Catch ex As Exception
                        tran1.Rollback() '事务回复
                Finally
                        tran1.Dispose()
                End Try

                Response.Redirect("login.aspx")
                conn.Close()
        End Sub
       
</script>

⌨️ 快捷键说明

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