hi!
here is some example:
protected void Login1_Authenticate( object sender, AuthenticateEventArgs e )
{
e.Authenticated = eLibraryUtils.loginUser( Login1.UserName, Login1.Password );
}
and the eLibraryUtils.loginUser() :
public static bool loginUser( string user_name, string password )
{
bool result = false;
SqlConnection conn = new
SqlConnection( ConfigurationManager.ConnectionStrings [
"eBConnectionString" ].ConnectionString );
try
{
SqlCommand cmd = new SqlCommand( "check_user", conn );
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter param = cmd.Parameters.Add( "@user_name",
SqlDbType.VarChar, 20 );
param.Value = user_name;
param = cmd.Parameters.Add( "@pass", SqlDbType.VarChar, 20 );
param.Value = password;
SqlParameter user_id = cmd.Parameters.Add( "@user_id", SqlDbType.Int );
user_id.Direction = ParameterDirection.Output;
conn.Open();
cmd.ExecuteNonQuery();
if(Convert.IsDBNull( user_id.Value ))
return false;
result = Convert.ToBoolean( user_id.Value );
}
finally
{
conn.Close();
}
return result;
}
hope it helps
orzeh
code less, think more!