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

.net - Generate assembly with Roslyn -

ZeroMQ on Windows, with Qt Creator -

batch file - filebot superstrict script: need tiny video sample or other solution -