Login problem

  • 13 years ago

    Hello, I'm writing an aspx form and need to check the login so if the user exist he can upload file if doesn't then he must register, I'm using the login control in visual studio but it's not working. I use this code:

    Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate

    Dim Authenticated As Boolean = False

    Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password)

    e.Authenticated = Authenticated

    If Authenticated = True Then


    End If

    End Sub

    Private Function SiteLevelCustomAuthenticationMethod(ByVal UserName As String, ByVal Password As String) As Boolean

    Dim boolReturnValue As Boolean = False

    'Dim strConnection As String = "datasource"

    Dim Connection As SqlConnection = New SqlConnection(conn)

    Dim strSQL As String = "Select * From Table1"

    Dim command As SqlCommand = New SqlCommand(strSQL, Connection)Dim Dr As SqlDataReader


    Dr = command.ExecuteReader

    While Dr.Read

    If ((UserName = Dr("UserName").ToString) And (Password = Dr("Pass").ToString)) Then

    boolReturnValue = True

    End If


    Return boolReturnValue

    End While

    End Function


    I get this code from the internet but it doesn't work for me, any ideas

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are 10 types of people in the world, those who can read binary, and those who can't.”