Login Page error in asp.net -
public partial class account_login : system.web.ui.page { protected void page_load(object sender, eventargs e) { } protected void loginbutton_click(object sender, eventargs e) { string uname = username.text.trim(); string pwd = password.text; datatable dt = new datatable(); using (sqlconnection con = new sqlconnection(configurationmanager.connectionstrings["project_dbconnectionstring"].connectionstring)) { sqlcommand cmd = new sqlcommand(); cmd.connection = con; cmd.commandtext = "select id, username, password, email [employee] username = '" + uname + "' , password = ' " + pwd + "' "; con.open(); sqldataadapter da = new sqldataadapter(); da.selectcommand = cmd; da.fill(dt); if (dt.rows.count > 0) { session.add("userid", dt.rows[0][0].tostring()); session.add("username", dt.rows[0][1].tostring()); session.add("password", dt.rows[0][2].tostring()); session.add("email", dt.rows[0][3].tostring()); if (dt.rows[0][1].tostring() == "admin") { response.redirect("~/admin/default.aspx", false); } else { response.redirect("~/memberpages/default.aspx", false); } } else { failuretext.text = "invalid username , password"; } } } } it gives me error @ username.text , password.text. says doesn't exist in context.
i don't know what's going wrong in this.
this same problem occuring registration page.
there may issue in designer file, can cause issue.
see: the name 'xxx' not exist in current context user control
Comments
Post a Comment