The following validation works fine on both client side and server side
<DisplayName("website")> _
<StringLength(256, ErrorMessage:="Web Address cannot exceed 256 characters.")> _
<RegularExpression("^http(s?)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$", ErrorMessage:="Not a valid website address")> _
Public Property WebSite As String
However this validation only works on the Server side
<DisplayName("website")> _
<StringLength(256, ErrorMessage:="Web Address cannot exceed 256 characters.")> _
<Website(ErrorMessage:="Not a valid website address")> _
Public Property WebSite As String
Where my custom WebsiteAttribute looks like this
Public Class WebsiteAttribute : Inherits RegularExpressionAttribute
Public Sub New()
MyBase.new("^http(s?)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$")
End Sub
End Class
I'm obviously missing something very simple.
Thanks in advance.