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

📄 members.aspx.vb

📁 Build words list automatic
💻 VB
字号:
Public Class members
    Inherits System.Web.UI.Page


#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents txtUsername As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtPassword As System.Web.UI.WebControls.TextBox
    Protected WithEvents btnLogin As System.Web.UI.WebControls.Button
    Protected WithEvents btnChangePassword As System.Web.UI.WebControls.LinkButton
    Protected WithEvents btnRegister As System.Web.UI.WebControls.LinkButton
    Protected WithEvents lblUserName As System.Web.UI.WebControls.Label
    Protected WithEvents lblPassword As System.Web.UI.WebControls.Label
    Protected WithEvents lblFeedback As System.Web.UI.WebControls.Label
    Protected WithEvents lblNew As System.Web.UI.WebControls.Label
    Protected WithEvents lblClick As System.Web.UI.WebControls.Label
    Protected WithEvents lblChange As System.Web.UI.WebControls.Label
    Protected WithEvents btnHere As System.Web.UI.WebControls.LinkButton
    Protected WithEvents hidPopup As System.Web.UI.HtmlControls.HtmlInputHidden

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '050607 JPC
        Response.Cache.SetCacheability(HttpCacheability.NoCache)
        '
        'Put user code to initialize the page here
        'Have we been sent here as login enforcement?
        If Not (Session("Username") Is Nothing) Then
            lblFeedback.ForeColor = Color.Green
            lblFeedback.Text = "You are already logged-in, '" & Session("Username") & "'.  You do not need this login form."
        ElseIf Not Session("StateMessage") Is Nothing Then
            lblFeedback.ForeColor = Color.Red
            lblFeedback.Text = Session("StateMessage")
            Session("StateMessage") = Nothing
            ''050612 JPC this is a popup.  Use page hidden field to record this fact.
            'hidPopup.Value = "POPUP"
        End If
        '
        
    End Sub

    Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
        Dim sSQL As String
        Dim dacc As New DataAccessBase
        Try
            '050611 JPC Database Connection Strings now constructed in Global.asax
            dacc.Open(Session("connDbControl"))
            sSQL = "SELECT * FROM Persons WHERE PersonId = '" & txtUsername.Text & "' " _
            & "AND Password = '" & txtPassword.Text & "' " _
            & "AND IsConfirmed <> 0;"
            Dim ds As DataSet = dacc.GetData("Persons", sSQL)
            If ds.Tables("Persons").Rows.Count = 1 Then
                'Successful Login
                Session("Username") = txtUsername.Text
                lblFeedback.ForeColor = Color.Green
                'Note the use of Request.ApplicationPath to identify this web app
                'Provide link for user to do something with the login, but exception
                'for popup enforced login for requested activity
                If Session("LoginNeed") Is Nothing Then
                    lblFeedback.Text = "Successful Login.<br>You now have entry to the " _
                    & "<a href=""#"" onclick=""top.location.href='" _
                    & Request.ApplicationPath & "/shell.aspx?areaDir=" _
                    & ConfigurationSettings.AppSettings("privilegedDir") & "';"">" _
                    & ConfigurationSettings.AppSettings("privilegedLabel") & " Area</a>"
                Else
                    lblFeedback.Text = "Successful Login."
                End If

                lblNew.Visible = False
                btnRegister.Visible = False
                lblClick.Visible = True
                btnHere.Visible = True
                btnLogin.Enabled = False
                lblChange.Visible = True
                btnChangePassword.Visible = True
                '
            Else
                lblFeedback.ForeColor = Color.Red
                lblFeedback.Text = "**Sorry, incorrect Username or Password!"
                lblNew.Visible = True
                btnRegister.Visible = True
                btnHere.Visible = False
                lblChange.Visible = False
                btnChangePassword.Visible = False
            End If
        Catch ex As Exception
            lblFeedback.ForeColor = Color.Red
            lblFeedback.Text = "ERROR: " & ex.Message
        Finally
            dacc.Close()
        End Try
        '
        '050520 JPC If we were sent here from another page 
        '  requiring login, Then return successful
        If InStr(1, lblFeedback.Text, "Successful Login", 1) Then
            If Not Session("LoginNeed") Is Nothing Then
                Dim sLoginNeed As String
                sLoginNeed = Session("LoginNeed")
                Session("LoginNeed") = Nothing
                Session("StateMessage") = "Successful Login.  You can now add notes."
                Server.Transfer(sLoginNeed)
            End If
        End If
        
    End Sub

    Private Sub btnRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRegister.Click
        Server.Transfer("registration.aspx")
    End Sub

    Private Sub btnChangePassword_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChangePassword.Click
        Server.Transfer("passchange.aspx")
    End Sub

    Private Sub btnHere_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHere.Click
        Server.Transfer("registration.aspx")
    End Sub

End Class

⌨️ 快捷键说明

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