asp.net mvc dataannotation validating url

后端 未结 9 725
离开以前
离开以前 2021-02-04 05:23

can some one tell me how can i validate a url like http://www.abc.com

9条回答
  •  灰色年华
    2021-02-04 06:03

    What about using URL attribute, like:

    public class ProveedorMetadata
    {
        [Url()]
        [Display(Name = "Web Site")]
        public string SitioWeb { get; set; }
    }
    

提交回复
热议问题