{
bool Authenticated = false;Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password);
e.Authenticated = Authenticated;
if (Authenticated == true){
Response.Redirect(
"Home.aspx");}
}
private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password){
bool ReturnValue = false; //string strConnection = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Data.mdf;Integrated Security=True;User Instance=True"; string str = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\\bhasker\\ricemill.mdb"; OleDbConnection conn = new OleDbConnection(str); String st = "Select username,password from User"; OleDbCommand cmd = new OleDbCommand(st, conn); OleDbDataReader dr;conn.Open();
//i am getting problem here can any one check this please
dr = cmd.ExecuteReader();
while(dr.Read()){
if ((UserName == dr["username"].ToString()) & (Password == dr["password"].ToString())){
ReturnValue =
true;}
}
return ReturnValue;dr.Close();
}
Mahesh ChandPosted May 8, 2008, 11:31 AM