Regular expression for validating url

If you don't specify any Error Message, a default error message is displayed.The [Email Address] attribute validates a property for a valid email address.The first version is used when you make a GET request and the other is used when the form is submitted by the end user.The second Index() method accepts User Profile as a parameter. The Is Valid property returns false if any of the properties contain invalid values.

Notice the attributes that are used to decorate these properties.

The [Required] attribute indicates that a property value must be provided.

The [String Length] attribute is used to specify the maximum length and optionally the minimum length for a property value.

Add the following code to the Home Controller class.

The Home Controller class contains two versions of the Index() action method.

Leave a Reply