PostSharpAPI ReferencePost­Sharp.​Patterns.​ContractsUrl­Attribute
Open sandboxFocus

UrlAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an System.ArgumentException if the target is assigned a value that is not a valid URL starting with http://, https:// or ftp://. Null strings are accepted and do not throw an exception.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common.dll
Syntax
[AspectConfiguration(SerializerType = null)]
public sealed class UrlAttribute : RegularExpressionAttribute, ILocationLevelAspect, IAspect
Remarks

Error message is identified by UrlErrorMessage.

Constructors

Name Description
UrlAttribute()

Initializes a new UrlAttribute.

Methods

Name Description
GetErrorMessage()

Gets unformatted error message as defined by the instance.

GetErrorMessageArguments()

Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on.