Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void button_Click(object sender, EventArgs e)
- {
- DBKariyerBL.User user = new DBKariyerBL.User();
- user.UserName = txtKlnAd.Text;
- user.Password = txtParola.Text;
- if (user.Login(user))
- {
- Session["LogIn"] = "1";
- Response.Redirect("Default.aspx");
- }
- }
- public class User
- {
- public string UserName { get; set; }
- public string Password { get; set; }
- SqlConnection conn = new SqlConnection(Util.ConnectionString);
- public bool Login(User user)
- {
- return Convert.ToInt32(SqlHelper.ExecuteScalar(conn, CommandType.Text, "SELECT COUNT(*) FROM Users WHERE UserName=@UserName AND Password=@Password", new SqlParameter[] { new SqlParameter("@UserName", user.UserName), new SqlParameter("@Password", user.Password) })) > 0;
- }
- }
- public class User : System.Web.Services.WebService
- {
- [WebMethod]
- public bool Login(DBKariyerBL.User user)
- {
- DBKariyerBL.User kull = new DBKariyerBL.User();
- return kull.Login(user);
- }
- }
- public class Util
- {
- public static string ConnectionString
- {
- get { return ConfigurationManager.ConnectionStrings["SqlConnection"].ConnectionString; }
- }
- }
- public class Util
- {
- public static string ConnectionString
- {
- get { return "Data Source=ServerName;" +
- "Initial Catalog=DataBaseName;" +
- "User id=UserName;" +
- "Password=pwd;"; }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement