I am working on a simple portal application using the ASP.NET membership and login controls. I would like to use the PasswordRecovery control to send emails containing forgotten passwords, however my portal requires localization. I have an existing Content Management System that I am pulling the localized strings out of and I would like to link the PasswordRecovery control to that system.
But, it appears that the PasswordRecovery control will ONLY accept a .txt file for the email body…the property is PasswordRecovery1.MailDefinition.BodyFileName
I do not want to use a file on disk, I would like to use the localized content in my CMS.
Is there any way to do this? It occurred to me that I might be able to use the SendingMail event to send my OWN email through the normal System.Net namespace, but that seems sorta cludgy…
Any thoughts?
Thanks,
Max
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Try handling the SendingMail event of the PasswordRecovery control. In that event, set the e.Message.Body and e.Message.Subject properties to your localized text.
Method 2
Found this by googling “BodyFileName localization”:
http://forums.asp.net/t/1118242.aspx:
Just bind the property to a key in
your page’s localresource file. The
page’s local resource file is the file
located in a subdirectory called
app_localresources in your page’s
directory. Just use visual studio’s
“tools -> create local resource”
option in design view for it be
created for you.In that file, create a string
key/value pair with something likeName: myBodyFileName
Value: myDefaultBodyFile.txt
Then bind this to the BodyFileName
property of the login control with
something like‘>
Then just create the sattelite local
resource files for other cultures and
map that key/value pair in those
resources to other body text files.By the way, if you used visual studio
to create the resource file for you,
then the binding may have been done
for you automatticaly. Just search for
a
“MyChangePasswordControlResource1.BodyFileName”
key in the resource file or something
similar.Regards, Jorge
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0