public void CheckLoginCredentials(string UserName, string Password) { rows = new List <Dictionary <string, object> >(); serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); ReturnValue = string.Empty; StudentClsObject = new StudentClass(); DataTable dt = new DataTable(); dt = StudentClsObject.CheckLoginCredentials(UserName, Password); Dictionary <string, object> row; foreach (DataRow dr in dt.Rows) { row = new Dictionary <string, object>(); foreach (DataColumn col in dt.Columns) { row.Add(col.ColumnName, dr[col]); } rows.Add(row); } // string s = HttpContext.Current.Session["ID"].ToString(); ; //HttpContext.Current.Session["ID"] = HttpContext.Current.Session["ID"].ToString(); // Context.Response.Clear(); // Context.Response.ContentType = "application/json"; Context.Response.Write(serializer.Serialize(rows)); }
protected void btnLogin_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); try { StudentClassObject = new StudentClass(); dt = StudentClassObject.CheckLoginCredentials(txtuserName.Text, txtPassword.Text); if (dt.Rows[0][0].ToString() == "Active") { // string key = Session.SessionID.ToString(); // Response.Write(Session.SessionID.ToString()); Response.Redirect("home.aspx"); } else { lblerrormsg.Text = dt.Rows[0][0].ToString(); } } catch (Exception) { // ReturnValue = "2"; } // return ds; }
public void CheckLoginCredentials(string UserName, string Password) { rows = new List<Dictionary<string, object>>(); serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); ReturnValue = string.Empty; StudentClsObject = new StudentClass(); DataTable dt = new DataTable(); dt = StudentClsObject.CheckLoginCredentials(UserName, Password); Dictionary<string, object> row; foreach (DataRow dr in dt.Rows) { row = new Dictionary<string, object>(); foreach (DataColumn col in dt.Columns) { row.Add(col.ColumnName, dr[col]); } rows.Add(row); } // string s = HttpContext.Current.Session["ID"].ToString(); ; //HttpContext.Current.Session["ID"] = HttpContext.Current.Session["ID"].ToString(); // Context.Response.Clear(); // Context.Response.ContentType = "application/json"; Context.Response.Write(serializer.Serialize(rows)); }