private void SetDatabaseConfig(XmlElement databaseConfigRootNode, DatabaseConfig dbConfig) { GetOrCreateElement(databaseConfigRootNode, "name").InnerText = dbConfig.name; if (dbConfig.DBType.Equals(WebUtils.DBTypeEmun.MSSQL)) { HROne.CommonLib.Crypto crypto = new HROne.CommonLib.Crypto(HROne.CommonLib.Crypto.SymmProvEnum.Rijndael); GetOrCreateElement(databaseConfigRootNode, "dbtype").InnerText = "MSSQL"; System.Data.SqlClient.SqlConnectionStringBuilder connStringBuilder = new System.Data.SqlClient.SqlConnectionStringBuilder(dbConfig.ConnectionString); connStringBuilder.Password = crypto.Encrypting(connStringBuilder.Password, keyString); GetOrCreateElement(databaseConfigRootNode, "ConnectionString").InnerText = connStringBuilder.ConnectionString; } }
private void SetDatabaseConfig(XmlElement databaseConfigRootNode, DatabaseConfig dbConfig) { XmlDocument config = databaseConfigRootNode.OwnerDocument; databaseConfigRootNode.AppendChild(config.CreateElement("name")); databaseConfigRootNode["name"].InnerText = dbConfig.name; databaseConfigRootNode.AppendChild(config.CreateElement("dbtype")); if (dbConfig.DBType.Equals(WebUtils.DBTypeEmun.MSSQL)) { HROne.CommonLib.Crypto crypto = new HROne.CommonLib.Crypto(HROne.CommonLib.Crypto.SymmProvEnum.Rijndael); databaseConfigRootNode["dbtype"].InnerText = "MSSQL"; databaseConfigRootNode.AppendChild(config.CreateElement("ConnectionString")); System.Data.SqlClient.SqlConnectionStringBuilder connStringBuilder = new System.Data.SqlClient.SqlConnectionStringBuilder(dbConfig.ConnectionString); connStringBuilder.Password = crypto.Encrypting(connStringBuilder.Password, keyString); databaseConfigRootNode["ConnectionString"].InnerText = connStringBuilder.ConnectionString; } }
protected void btnSubmit_Click(object sender, EventArgs e) { PageErrors pageErrors = PageErrors.getErrors(null, this.Page); if (!IsValidPassCode(txtPassCode.Text)) { pageErrors.addError("Incorrect Pass Code!"); return; } HROne.CommonLib.Crypto crypto = new HROne.CommonLib.Crypto(HROne.CommonLib.Crypto.SymmProvEnum.Rijndael); Session["LoginID"] = crypto.Encrypting("EM", Session.SessionID); //EUser user = new EUser(); //user.UserID = -1; //user.LoginID = "EM"; //Session["User"] = user; Session["IgnoreEM"] = false; Session.Remove("User"); HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/Default.aspx"); }
public static HROne.SaaS.Entities.EUser GetCurUser(HttpSessionState Session) { DatabaseConnection dbConn = HROne.Common.WebUtility.GetDatabaseConnection(Session); HROne.SaaS.Entities.EUser CurrentUser = null; if (Session["User"] == null) { if (Session["LoginID"] != null) { HROne.CommonLib.Crypto crypto = new HROne.CommonLib.Crypto(HROne.CommonLib.Crypto.SymmProvEnum.Rijndael); if (Session["LoginID"].ToString().Equals(crypto.Encrypting("EM", Session.SessionID))) { CurrentUser = new HROne.SaaS.Entities.EUser(); CurrentUser.LoginID = "EM"; CurrentUser.UserID = -1; } if (Session["PasswordEncrypted"] != null) { HROne.SaaS.Entities.EUser user = null; if (ValidateUser(dbConn, Session["LoginID"].ToString(), Session["PasswordEncrypted"].ToString(), false, false, out user)) { CurrentUser = user; } else { Session.Remove("LoginID"); Session.Remove("PasswordEncrypted"); } } } if (CurrentUser != null) { Session["User"] = CurrentUser; } } else { CurrentUser = (HROne.SaaS.Entities.EUser)Session["User"]; } return(CurrentUser); }