We are using the kentico software to create a easily used survey site.
A common feature for a survey site is to be able to upload a list of users and after that send a mass e-mail to all the users that are going to use the survey with their username and password.
We created a module where users can be uploaded through a csv file. Now we are building the mass e-mail part. functionality:
- Select a group of users.
- Type E-mail tekst
- Be able to use the markers <%Fullname%>, <%Username%>, <%Password%> (for the mail merge).
When we call GetPassword() on the CMSMembershipUser we get a strange error:
Key cannot be null.
After some investigation we noticed that although we set te password format on cleartext in the web.config it always saves the password hashed. We know there is no way the retreive a hashed password.
How can we solve this problem? (For example can we save the password in clear text/encrypted?)
Code example:
UserInfo ui = UserInfoProvider.GetUserInfo(ValidationHelper.GetInteger(dr["MemberUserID"], 0));
if (ui != null)
{
string EmailContent = txtEmailContent.Text.Replace(sFullName, ui.FullName);
EmailContent = EmailContent.Replace(sUserName, ui.UserName);
CMSMembershipUser muser = new CMSMembershipUser(ui);
EmailContent = EmailContent.Replace(sPassword, muser.GetPassword());
}
Exception:
Key cannot be null.
Parameter name: key
at System.Collections.Hashtable.get_Item(Object key)
at System.Configuration.Provider.ProviderCollection.get_Item(String name)
at System.Web.Security.MembershipProviderCollection.get_Item(String name)
at System.Web.Security.MembershipUser.GetPassword()
at CMSModules_CorrelatieRekenmodule_Default.CreateMailingList() in d:\Projects\DirectGovernance-Calibratie\KenticoCMS\CMSModules\SurveyUsers\Default.aspx.cs:line 318
at CMSModules_CorrelatieRekenmodule_Default.btnSend_Click(Object sender, EventArgs e) in d:\Projects\DirectGovernance-Calibratie\KenticoCMS\CMSModules\SurveyUsers\Default.aspx.cs:line 56
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Kind regards,
Olivier v/d Rhoer