Imports System.Data.SqlClient Imports System.Configuration.ConfigurationManager Partial Class _default Inherits System.Web.UI.Page Protected Sub giris_Click(sender As Object, e As EventArgs) Handles giris.Click Dim conn As New SqlConnection(ConnectionStrings("ConnectionString").ToString) Dim COMM As New SqlCommand Dim rdr As SqlDataReader 'ekrandan girilen kullanıcı adı ve şifre kontrol edilir conn.Open() COMM = conn.CreateCommand() COMM.CommandText = "SELECT USERNAME, USERPSW FROM SABITLER WHERE USERNAME = '" & username.Text & "' and USERPSW = '" & password.Text & "'" rdr = COMM.ExecuteReader If Not rdr.Read Then mesaj.Visible = True mesaj.Text = "Geçersiz kimlik bilgileri." conn.Close() Exit Sub End If conn.Close() '--------------------------------------- 'cookie oluşturulur ------------------------- Dim userCookie As New HttpCookie("kullanici") userCookie("user") = username.Text userCookie.Expires = DateTime.Now.AddDays(1) Response.Cookies.Add(userCookie) '-------------------------------------------- Response.Redirect("duyuru-listesi.aspx") End Sub End Class