CreateUserWizard.EmailRegularExpression Property
Gets or sets a regular expression used to validate the provided e-mail address.
Assembly: System.Web (in System.Web.dll)
<asp:CreateUserWizard EmailRegularExpression="String" />
Property Value
Type: System.StringA string containing the regular expression used to validate an e-mail address. The default value is an empty string ("").
Use the EmailRegularExpression property to specify a regular expression that validates the e-mail address entered by the user to confirm that it matches a specific pattern. A common use is to make sure that the user has entered a complete e-mail address, such as user@contoso.com. The regular expression is used in addition to any restrictions placed on the e-mail address by the membership provider specified in the MembershipProvider property. If the membership provider rejects the e-mail address for any reason, the text contained in the InvalidEmailErrorMessage property is displayed.
The address is only compared to the regular expression if the RequireEmail property is set to true.
If the e-mail address does not pass the regular expression, the text contained in the EmailRegularExpressionErrorMessage property is displayed to the user.
The following code example assigns a regular expression to the EmailRegularExpression property to make sure that the user entered their e-mail address in a valid format, such as username@contoso.com.
<%@ page language="VB"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>CreateUserWizard.EmailRegularExpression sample</title> </head> <body> <form id="form1" runat="server"> <div> <asp:createuserwizard id="Createuserwizard1" runat="server" emailregularexpression='@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"' emailregularexpressionerrormessage="E-mail address must be in a valid format"> </asp:createuserwizard> </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.