AnthonyOSX
AnthonyOSX

Reputation: 348

Where do ASP.NET validation controls validate data?

According to Microsoft it is good enough to just use their validation controls to validate form data. The problem is, I'm not sure whether or not these controls also validate the information on the server as I see no code to indicate this. Client sided validation can easily be bypassed, so I'm wondering whether or not it would be useful for me to write my own validation class for server sided validation if the controls do not already do this.

Upvotes: 0

Views: 217

Answers (2)

David P
David P

Reputation: 2093

I would avoid using Microsoft's Server or Client Side validation tools. Its always best to validate your form before form submit. There are many many javascript libraries that can help you validate forms, including Parsley:

http://parsleyjs.org/

You can even do AJAX validations, so that you can lookup whether a value is valid in a database table.

Upvotes: 0

Win
Win

Reputation: 62260

Normally, you validate at Client Side first using ASP.Net Validation Controls.

When the page is posted back to server, you use IsValid to validate -

// If user disables java script, IsValid will return false.
if (IsValid)
{
    // Then you validate inputs based on your business logic.
}

Upvotes: 3

Related Questions