c# - web url validator to class level validation -


i have simple class , corresponding properties. add validation rules (to web property). want check web address valid. types of conditions need check for?

my thinking: have require format www.example.sometext

should check valid .sometext endings (i.e. .com, .org, etc.) problem there unlimited of these now.

so question add validation rule on class level handle this?

public string webaddress { get; set; } 

you can use uri.iswellformeduristring method. return true if string well-formed, if not return false.

link msdn: iswellformeduristring


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -