CreateUserWizard.Answer Property
Gets or sets the end user's answer to the password recovery confirmation question.
Assembly: System.Web (in System.Web.dll)
The membership provider specified in the MembershipProvider property will determine whether the question and answer text boxes are displayed at run time.
If an answer is required by the membership provider specified in the MembershipProvider property, then the answer text box will appear on the CreateUserWizard control. Each text box displayed on the CreateUserWizard control has a RequiredFieldValidator object associated with it.
This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins.
The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see LocalizableAttribute and ASP.NET Globalization and Localization.
The following code example modifies the e-mail message in the SendingMail event to include the user's password recovery confirmation answer in the message that is sent to new users.
Imports System Imports System.Web Imports System.Web.UI.WebControls Imports System.Security.Permissions Namespace Samples.AspNet.VB.Controls <AspNetHostingPermission(System.Security.Permissions.SecurityAction.Demand, _ Level:=AspNetHostingPermissionLevel.Minimal)> _ <AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, _ Level:=AspNetHostingPermissionLevel.Minimal)> _ Public Class CustomCreateUserWizard Inherits CreateUserWizard Public Sub New() Me.MailDefinition.BodyFileName = "MailFile.txt" Me.MailDefinition.From = "userAdmin@your.site.name.here" End Sub Protected Overloads Sub OnSendingMail(ByVal e As MailMessageEventArgs) e.Message.Subject = "New user on Web site." ' Replace placeholder text in message body with information ' provided by the user. e.Message.Body.Replace("<%PasswordQuestion%>", Me.Question) e.Message.Body.Replace("<%PasswordAnswer%>", Me.Answer) MyBase.OnSendingMail(e) End Sub End Class End Namespace
The following code example demonstrates a Web page that uses the CustomCreateUserWizard.
<%@ Page Language="VB"%> <%@ Import namespace="Samples.AspNet.VB.Controls" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Dim createUser As New CustomCreateUserWizard Placeholder1.Controls.Add(createUser) End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>CreateUserWizard.OnSendingMail sample</title> </head> <body> <form id="form1" runat="server"> <div> <asp:placeholder id="Placeholder1" runat="server" > </asp:placeholder> </div> </form> </body> </html>
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.