Changed to use Authenticate asp.net event instead of Authorize
[castle.git] / Components / Validator / Castle.Components.Validator / Attributes / ValidateEmailAttribute.cs
blob1c62f0c738372afed7bb4455b91ce173e06a4c7a
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.Components.Validator
17 using System;
19 /// <summary>
20 /// Validate that this email address is a valid one.
21 /// </summary>
22 /// <remarks>
23 /// This only check the format of the email, not if it really exists.
24 /// </remarks>
25 [Serializable, CLSCompliant(false)]
26 public class ValidateEmailAttribute : AbstractValidationAttribute
28 /// <summary>
29 /// Initializes a new instance of the <see cref="ValidateEmailAttribute"/> class.
30 /// </summary>
31 public ValidateEmailAttribute()
35 /// <summary>
36 /// Initializes a new instance of the <see cref="ValidateEmailAttribute"/> class.
37 /// </summary>
38 /// <param name="errorMessage">The error message.</param>
39 public ValidateEmailAttribute(string errorMessage) : base(errorMessage)
43 /// <summary>
44 /// Constructs and configures an <see cref="IValidator"/>
45 /// instance based on the properties set on the attribute instance.
46 /// </summary>
47 /// <returns></returns>
48 public override IValidator Build()
50 IValidator validator = new EmailValidator();
52 ConfigureValidatorMessage(validator);
54 return validator;