8
Answers

How to check is admin or not after login

Sivakumar

Sivakumar

8y
409
1
Hi ,
 
I want to check condition after login is admin or not
 
This is my code :
 
 
 
data is coming like above image  
 
protected void txtLogin_Click(object sender, EventArgs e)
{
LoginModel login = new LoginModel();
login.UserName = txtUserName.Text;
login.Password = txtPassword.Text;
var result =_loginBL.UserLogin(login);
txtUserName.Text = "";
txtPassword.Text = "";
if (result !=null)
{
Session["userName"] = login.UserName;
//string type = ballogin.usertype(login);
//Session["usertype"] = type;
Response.Redirect("home.aspx");
}
//else if (a == 2)
//{
// Session["userName"] = userName;
// Response.Redirect("adminHome.aspx");
//}
else
{
error.Text = "Enter the valid details";
}
 
Please help me 

Answers (8)