Email Address Validation for ASP.NET

前端 未结 8 862
梦如初夏
梦如初夏 2020-12-01 13:45

What do you use to validate an email address on a ASP.NET form. I want to make sure that it contains no XSS exploits.

This is ASP.NET 1.1

8条回答
  •  情话喂你
    2020-12-01 14:14

    You can use a RegularExpression validator. The ValidationExpression property has a button you can press in Visual Studio's property's panel that gets lists a lot of useful expressions. The one they use for email addresses is:

    \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
    

提交回复
热议问题