-
Notifications
You must be signed in to change notification settings - Fork 0
/
giris.aspx.cs
38 lines (35 loc) · 1.18 KB
/
giris.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Drawing;
using System.Linq;
public partial class giris : System.Web.UI.Page
{
private TurPaylasimEntities db = new TurPaylasimEntities();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void buttonGiris_Click(object sender, EventArgs e)
{
var uye = db.tblUye.FirstOrDefault(u => u.KullaniciAdi == TextBoxMailKadi.Text && u.Sifre == TextBoxSifre.Text || u.Mail == TextBoxMailKadi.Text && u.Sifre == TextBoxSifre.Text);
try
{
if (uye != null)
{
labelMessage.ForeColor = Color.Green;
Session["uyeId"] = uye.Id;
Session["uyeKadi"] = uye.KullaniciAdi;
labelMessage.Text = "Giriş başarılı";
Response.AddHeader("REFRESH", "3;URL=/");
}
else
{
labelMessage.ForeColor = Color.Red;
labelMessage.Text = "Kullanıcı adı veya şifre hatalı";
}
}
catch (Exception hata)
{
labelMessage.ForeColor = Color.Red;
labelMessage.Text = "Hata oluştu : " + hata.Message;
}
}
}