asp.net mvc dataannotation validating url

后端 未结 9 724
离开以前
离开以前 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 05:41

    Now (at least form ASP.NET MVC 5) you can use UrlAttribute and that includes server and client validation:

    [Url]
    public string WebSiteUrl { get; set; }
    

提交回复
热议问题