locked
Customizing the Membership password reset email RRS feed

  • Question

  • User-1767698477 posted

    I have seen customized password reset emails. How does one change the very cryptic and brief email received from the Password reset tool?

    Wednesday, May 20, 2020 6:16 AM

Answers

All replies

  • User409696431 posted

    Which asp.net variation are you using (Webforms, MVC full framework, Core, ...?); which membership library?

    Wednesday, May 20, 2020 4:14 PM
  • User-1767698477 posted

    I wrote my web application using Visual Studio 2010  in vb.net

    I also have VS 2019 but I have not used it at all.

    Wednesday, May 20, 2020 5:36 PM
  • User409696431 posted
    Please answer my questions. Web forms? MVC? Membership type?
    Wednesday, May 20, 2020 6:02 PM
  • User475983607 posted

    sking, I assume you are still working with the ASP.NET Membership Provider.  You really should take some time to read through the Membership Provider reference documentation so you understand the features available in the API.  The MembershipUser has a ResetPassword method that resets the user's password but does not send an email.

    https://docs.microsoft.com/en-us/dotnet/api/system.web.security.membershipuser.resetpassword?view=netframework-4.8

    Emailing up to you and you can send whatever email message you like.

    Wednesday, May 20, 2020 6:15 PM
  • User-1767698477 posted

    mgebhard, yes, sql memebrship provider. I have had plenty a good read on this page some time ago.  I'm using it now successfully. This document tells no where how to modify the email message that is sent. I have seen other websites send out password reset password that are more attractive than the email that it sends out.  This article doesn't explain how to customize the email. Is there a way to make it look better? I have seen reset emails in html with images.

    Thursday, May 21, 2020 5:01 AM
  • User1535942433 posted

    Hi sking,

    Accroding to your description,I'm guessing that you want to custome the email of the Membership password reset.I suggest you need custom code to do it.

    More details,you could refer to below article:

    https://forums.asp.net/t/1516816.aspx?Send+mail+after+MembershipProvider+ResetPassword+

    Best regards,

    Yijing Sun

    Thursday, May 21, 2020 5:46 AM
  • User475983607 posted

    mgebhard, yes, sql memebrship provider. I have had plenty a good read on this page some time ago.  I'm using it now successfully. This document tells no where how to modify the email message that is sent. I have seen other websites send out password reset password that are more attractive than the email that it sends out.  This article doesn't explain how to customize the email. Is there a way to make it look better? I have seen reset emails in html with images.

    Did you read the link in my last post?

    Use the MembershipUser.ResetPassword to reset the password.  Send a custom email using SmtpClient.  MembershipUser.ResetPassword does not send an email like Membership.ResetPassword.   The link provided in my last post has a code sample that writes the temporary password to the web form.  You'll modify this example and send an email rather than showing the reset password.  This is code that you need to write.

    An alternative is extending the Membership provider which  is also code that you need to write.

    Thursday, May 21, 2020 11:01 AM
  • User379720387 posted

    They are probably using an email service like sendgrid, where sendgrid provided a template which then gets customized by you for your application.

    You make an api call with the custom fields (first name, email), and an identifier which template to use.

    Here is a good place to start: https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/

    Beware, sendgrid api and their documentation can be rough around the edges.

    Thursday, May 21, 2020 3:26 PM
  • User-1767698477 posted

    The problem with this is that is just asks for a username in the page example.  Well, what if you forgot your username?  It also doesn't ask a security question which is part of the membership. This tool asks the security question. 

    <asp:PasswordRecovery ID="PasswordRecovery1" runat="server" Width="280px"
    UserNameInstructionText="Enter your User Name to reset it"
    BackColor="AliceBlue" BorderColor="#CCCC99" BorderStyle="Solid" BorderWidth="1px"
    Font-Names="Verdana" Font-Size="10pt"
    QuestionFailureText="Your answer could not be verified <br> Please try again." >
    <QuestionTemplate>

    requiresQuestionAndAnswer="true"is set my web.config. So this tool must look up the member by username in the membership and reset the password without asking the security question?

    Saturday, May 23, 2020 6:27 AM
  • User1535942433 posted

    Hi sking,

    Accroding to your description,as far as I think,only the usename is right,the reset password button is enabled.

    More details,you could refer to below articles:

    https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.passwordrecovery?view=netframework-4.8

    https://docs.microsoft.com/en-us/dotnet/api/system.web.security.membership.enablepasswordreset?view=netframework-4.8

    Best regards,

    Yijing Sun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 26, 2020 6:58 AM