Should I always call Page.IsValid in ASP.NET WebForms C#?

Posted by mkelley33 on Stack Overflow See other posts from Stack Overflow or by mkelley33
Published on 2009-06-24T16:31:52Z Indexed on 2010/04/27 11:33 UTC
Read the original article Hit count: 262

Filed under:
|
|
|
|

I know to never trust user input, since undesirable input could be compromise the application's integrity in some way, be it accidental or intentional; however, is there a case for calling Page.IsValid even when no validation controls are on the page (again, I know its bad practice to be trusting user input by omitting validation)? Does Page.IsValid perform any other kinds of validation? I looked at MSDN, and the docs seem to suggest that Page.IsValid is only effective if there are validation controls on the page, or the Page.Validate method has been called. A friend of mine suggested that I always check Page.IsValid in the button click handlers every time even if there are no validation controls or explicit Page.Validate calls.

Thanks for any advice!

© Stack Overflow or respective owner

Related posts about validation

Related posts about c#