private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
{
bool boolReturnValue = false;
string strConnection = ConnectionString;
SqlConnection Connection = new SqlConnection(strConnection);
string strUserID = UserName;
String strSQL = "select * from UserDetails where UDUSRID=\'" + (strUserID + "\'");
SqlCommand command = new SqlCommand(strSQL, Connection);
SqlDataReader Dr;
Connection.Open();
Dr = command.ExecuteReader();
while (Dr.Read())
{
string UserNameDB = Dr["UDUSRID"].ToString();
string PasswordDB = Dr["UDPASSWD"].ToString();
// string UserRoleDB = Dr["UDROLE"].ToString();
if ((UserName == UserNameDB.TrimEnd().TrimStart()) & (Password == PasswordDB.TrimEnd().TrimStart()))
{
Session["Usrid"] = UserNameDB;
Session["Uspasswd"] = PasswordDB;
// Session["Usrole"] = UserRoleDB;
// Response.Write(Session["Usrole"]);
// Response.End();
boolReturnValue = true;
break;
}
}
Dr.Close();
return boolReturnValue;
}
{
bool boolReturnValue = false;
string strConnection = ConnectionString;
SqlConnection Connection = new SqlConnection(strConnection);
string strUserID = UserName;
String strSQL = "select * from UserDetails where UDUSRID=\'" + (strUserID + "\'");
SqlCommand command = new SqlCommand(strSQL, Connection);
SqlDataReader Dr;
Connection.Open();
Dr = command.ExecuteReader();
while (Dr.Read())
{
string UserNameDB = Dr["UDUSRID"].ToString();
string PasswordDB = Dr["UDPASSWD"].ToString();
// string UserRoleDB = Dr["UDROLE"].ToString();
if ((UserName == UserNameDB.TrimEnd().TrimStart()) & (Password == PasswordDB.TrimEnd().TrimStart()))
{
Session["Usrid"] = UserNameDB;
Session["Uspasswd"] = PasswordDB;
// Session["Usrole"] = UserRoleDB;
// Response.Write(Session["Usrole"]);
// Response.End();
boolReturnValue = true;
break;
}
}
Dr.Close();
return boolReturnValue;
}
No comments:
Post a Comment