Using Enteprise Library for request param validation

Topics: Validation Application Block
Jul 11, 2009 at 5:12 PM


I am been looking for an example how to validate request param with enteprise library. I was expecting to find it as the first example since this the most common validation need in a web application.

But no luck.

How can i validate
string dangerousValue = Request["dangerousinput"]

I want to use Regexp validation or other type of validation on this.







Jul 13, 2009 at 4:19 AM

You could use :

<font size="2" color="#2b91af">



regexValidator = new RegexValidator(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");

ValidationResults results = regexValidator.Validate(Request["dangerousInput"]);


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.