Export (0) Print
Expand All
Expand Minimize

CreateUserWizard.EmailRegularExpression Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets a regular expression used to validate the provided e-mail address.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public virtual string EmailRegularExpression { get; set; }
/** @property */
public String get_EmailRegularExpression ()

/** @property */
public void set_EmailRegularExpression (String value)

public function get EmailRegularExpression () : String

public function set EmailRegularExpression (value : String)

Property Value

A 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="C#"%>

<script runat="server">

</script>

<html>
<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 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2015 Microsoft