Jump to content

asp.net 2.0 login page error (transferred post)


Guest thestig888

Recommended Posts

Guest thestig888

hi there I'm currently trying to set up a login page for a site using webmatrix which presents the following message upon successful login "welcome" and "unknown login" if the details are incorrectly entered, however when i run the page neither of the messages are appearing when the submit button is pressed.i was told to transfer this post this to the .net thread as the issue was .net related.the sql appears to be correct with the table being called users, the code for the login page is below

Function login(ByVal username As String, ByVal password As String) As System.Data.DataSet        Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=..\datab\assignment2-cclocks1.mdb"        Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)        Dim queryString As String = "SELECT [users].[username], [users].[Password] FROM [users] WHERE (([users].[usern"& _            "ame] = @Username) AND ([users].[Password] = @Password))"        Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand        dbCommand.CommandText = queryString        dbCommand.Connection = dbConnection        Dim dbParam_username As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter        dbParam_username.ParameterName = "@Username"        dbParam_username.Value = username        dbParam_username.DbType = System.Data.DbType.[string]        dbCommand.Parameters.Add(dbParam_username)        Dim dbParam_password As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter        dbParam_password.ParameterName = "@Password"        dbParam_password.Value = password        dbParam_password.DbType = System.Data.DbType.[string]        dbCommand.Parameters.Add(dbParam_password)        Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter        dataAdapter.SelectCommand = dbCommand        Dim dataSet As System.Data.DataSet = New System.Data.DataSet        dataAdapter.Fill(dataSet)        Return dataSet        Dim hashMethod as string        hashMethod = "MD5"        Dim encryptPassword as string        encryptPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(loginpassword.Text, hashMethod)        Dim loginpwd As New System.Data.DataSet        loginpwd = login(loginusername.Text, encryptPassword)        If loginpwd.tables(0).Rows.Count <> 1 Then        loginresult.text = "Unknown login"        Else        loginresult.text = "hello"        End If        test.text="ERROR in data insert : "    End Function

thanks.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...