private void CheckAvailablity(string UserName, string Password) { string uName = string.Empty; HiddenField hf = (HiddenField)this.FindControl("ctl00$HiddenFieldAvailability"); UserInfoManager objUserInfoManager = new UserInfoManager(); GenralUserInfo _objGenralUserInfo = new GenralUserInfo(); UserInfo objUserInfo = new UserInfo(); objUserInfo.UserName = UserName; objUserInfo.UserPassword = Password.ToLower().ToString();; _objGenralUserInfo.RecentUsers = objUserInfo; objUserInfoManager.UserLogin(_objGenralUserInfo); if (_objGenralUserInfo.CustomError == null) { SetSessionValue(_objGenralUserInfo); Response.Write("true"); } else { Response.Write("false"); } }
private void CheckUserAvailablity(string UserName, string Password) { errorPwd.Visible = false; string uName = string.Empty; HiddenField hf = (HiddenField)this.FindControl("ctl00$HiddenFieldAvailability"); UserInfoManager objUserInfoManager = new UserInfoManager(); GenralUserInfo _objGenralUserInfo = new GenralUserInfo(); UserInfo objUserInfo = new UserInfo(); objUserInfo.UserName = UserName; objUserInfo.UserPassword = Password.ToLower().ToString(); objUserInfo.ApplicationType = ConfigurationManager.AppSettings["ApplicationType"].ToString(); _objGenralUserInfo.RecentUsers = objUserInfo; objUserInfoManager.UserLogin(_objGenralUserInfo); if (_objGenralUserInfo.CustomError == null) { //added the below two lines to handle the session issue Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", Session.SessionID)); Response.Cookies["ASP.NET_SessionId"].Domain = "." + WebConfig.TopLevelDomain; SetSessionValue(_objGenralUserInfo); RedirectPage(); } else { errorPwd.Visible = true; ScriptManager.RegisterClientScriptBlock(Page, GetType(), "HidePanel", "setIndicatorPassword_();", true); } }
public void UserLoginTest() { UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value GenralUserInfo objUser = new GenralUserInfo(); UserInfo objUserInfo = new UserInfo(); int UserId = InsertDummyUser("tj_op"); objUserInfo.UserName = "******"; objUserInfo.UserPassword = "******"; objUserInfo.FacebookUid = null; objUser.RecentUsers = objUserInfo; //testing UserLogin Function target.UserLogin(objUser); //Testing CheckLogin function inside UserLogin Function object[] objParam ={ objUser.RecentUsers.UserName.ToString(), objUser.RecentUsers.UserPassword.ToString(), objUser.RecentUsers.FacebookUid }; DataSet _objDataSet = GetDataSetWithoutCheckingIOVS("usp_ValidateWebsiteUser", objParam); int count = _objDataSet.Tables[0].Rows.Count; Assert.AreEqual(1, count); if (count > 0) { Assert.AreEqual(UserId, (int)_objDataSet.Tables[0].Rows[0]["UserId"]); Assert.AreEqual("tj_op", _objDataSet.Tables[0].Rows[0]["UserName"].ToString()); } }