Richard Banks
Richard Banks

Reputation: 2983

jQuery, C# and server side data validation

I've been using jQuery to post data and was wondering how best to perform server-side validation on the data. I check the values client-side but know it's good practice to also check server-side.

I've searched online but can't really find any examples.

Upvotes: 1

Views: 1299

Answers (3)

Caspar Kleijne
Caspar Kleijne

Reputation: 21864

There are many ways of doing validation server side, but to make it easy for you you could use an existing library.

the Microsoft Enterprise Library 5.0 offers a bunch of features that you can use to implement common practices. Validation is one of them. Microsoft Enterprise Library is a collection of application blocks designed to assist developers with common enterprise development challenges.

The Enterprise Library Validation Application Block provides useful features that allow developers to implement structured and easy-to-maintain validation scenarios in their applications.

a great sample is found at Using Validation Block Attributes to Define Validation Rule Sets

more here: http://msdn.microsoft.com/en-us/library/ff664356(v=PandP.50).aspx

Upvotes: 1

Frédéric Hamidi
Frédéric Hamidi

Reputation: 263047

Check out ASP.NET server-side validation.

Upvotes: 0

Joel Martinez
Joel Martinez

Reputation: 47789

You can either do it manually (ie, if (model.Value != null)), or via data annotations

Upvotes: 0

Related Questions