private void btnDecrypt_Click(object sender, System.EventArgs e) { try { SecurityHandler objSecurityHandler = new SecurityHandler(); this.txtDecrypted.Text = objSecurityHandler.Decrypt(this.txtEncrypted.Text); } catch (Exception ex) { MessageBox.Show("Error Decrypting Text" + Environment.NewLine + ex.Message); } }
/// <summary> /// Application has started event /// </summary> /// <param name="sender">Object</param> /// <param name="e">EventArgs</param> protected void Application_Start(Object sender, EventArgs e) { try { SecurityHandler objSecurityHandler = new SecurityHandler(); string strEncPassword = ConfigurationSettings.AppSettings["ConnectionStringPassword"]; string strDecPassword = objSecurityHandler.Decrypt(strEncPassword); HttpContext.Current.Application["password"] = strDecPassword; // Get Application level Settings from database and store in the Application state ApplicationSettings.InitializeSettings(); } catch { // Nothing can be done. } }