Imports System.Data.OleDb Imports System.Data.CommandType Partial Class login_login Inherits System.Web.UI.Page Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click getData(txtUsername.Text, txtPwd.Text) End Sub Public Sub getData(ByVal usr As String, ByVal pwd As String) Dim conn As OleDbConnection Dim rs As OleDbDataReader Dim cmd As Data.OleDb.OleDbCommand conn = New Data.OleDb.OleDbConnection(System.Configuration.ConfigurationManager.AppSettings("conn") & Server.MapPath(System.Configuration.ConfigurationManager.AppSettings("db"))) conn.Open() cmd = New OleDbCommand("select pwd from DD_Login where usr='" & usr & "' and pwd='" & pwd & "'", conn) cmd.CommandType = Data.CommandType.Text rs = cmd.ExecuteReader If rs.Read <> 0 Then FormsAuthentication.SetAuthCookie(txtUsername.Text, False) Response.Redirect("leden.aspx") Else lbl.Text = "Login failed!" End If rs.Close() conn.Close() End Sub End Class