[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Changing the MailDefinition.BodyFileName of PasswordRecovery control programmatically?

Posted on 2007-10-16
4
Medium Priority
?
3,687 Views
Last Modified: 2008-01-09
Hi,

I have a passwordRecovery control and a custom text file which contains the Body of the email.  I get the email fine if I specify the File name at design time in the MailDefinition of the PasswordRecovery control:

 <MailDefinition From="info@Intamac.com" Subject="Your New Password" BodyFileName="PasswordMail.txt">  
    </MailDefinition>

However I need to set the Text file at runtime based on the users current theme.  I have tried to do this in the PasswordRecovery's sendingMail event but this just sends the default email out.  ie (doesn't apply the text file)  here's what i'm doing:

Protected Sub PswdRecovery_SendingMail(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MailMessageEventArgs) Handles PswdRecovery.SendingMail
        Me.PswdRecovery.MailDefinition.BodyFileName = "PasswordMail.txt"
    End Sub

The text file is in the same dir as the page so this isn't the problem.  Any ideas?
0
Comment
Question by:fizzer666
  • 2
  • 2
4 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 20084664
Have you tried changing the BodyFileName before the SendingMail event?

Bob
0
 

Author Comment

by:fizzer666
ID: 20084869
I tried putting it in the page load event but only on a load eg:

If Not Page.IsPostBack Then
            Me.PswdRecovery.MailDefinition.BodyFileName = miscFunctions.getThemeDir & "/PasswordMail.txt"
  End If

This didn't work unless I take it out of the if condition.  At least now it works but this will fire multiple times.  Is there an event I can use which will only fire this once?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20084939
Is there a problem if the BodyFileName is set twice?

Bob
0
 

Author Comment

by:fizzer666
ID: 20085307
It doesn't effect the outcome but I just wondered whether there was a more efficient way.  In this instance, your right, I suppose it's not much of a perfomance hit.  Thanks for your help.  
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question