Hi Team,
My requirement is to encrypt a user provided value(db connection password) and update the encrypted value in a connection string in web.config(XML) file. I want to use another dll to encrypt the password.
As suggested in http://www.advancedinstaller.com/user-g ... rp-ca.html link, I am able to encrypt the password.
I want to return the encrypted value in the dll i.e. currently in session.Item("RET_VAL_FROM_ENCRYPT").
Below is the code snippet to encrypt the password.
[CustomAction()]
public static ActionResult CA_EncryptString(Session session)
{
session.Log("Begin CA_EncryptString");
string sToEncrypt = "";
try {
sToEncrypt = session.Item("VAL_TO_ENCRYPT");
session.Item("RET_VAL_FROM_ENCRYPT") = EncryptDecrypt.EncryptDecrypt.Encrypt(sToEncrypt);
MessageBox.Show(session.Item("RET_VAL_FROM_ENCRYPT")); // This is showing the encrypted password
} catch (Exception ex) {
session.Log("Error in CA_EncryptString: " + ex.Message);
return ActionResult.Failure;
}
session.Log("End CA_EncryptString");
return ActionResult.Success;
}
Kindly suggest the way to return value in session variable to custom action and then update the value in web.config file.
Thanks in advance
Srinu Gatla
FOLLOW US
Get the latest news in Application Packaging