r/ASPNET • u/davegri • May 21 '13
Beginner to Asp.net, need help with server-side validation
I pasted all my code on this stack overflow question:
http://stackoverflow.com/questions/16664483/validating-server-side-with-asp-net-and-c-sharp
This is basically my question:
I think i'm doing everything right so far (I'm a beginner in anything beyond html/css) but correct me if I've made any errors.
What I want to do now is validate my form input server-side before I insert it into my database. I want to check that it obeys all my rules, char-lengths, matching fields and so forth - and also that the username/email isn't taken already.
I'm currently doing some basic javascript validation but I understand that isn't sufficient security wise.
an explanation (as simple as possible) as to what I have to go about doing now, would be great. Ideally i would like to return to the signup page and list the errors at the top of the form in a customizable way.
thanks
View all comments
Show parent comment
1
u/screwdad May 22 '13
Unfortunately the citation is generally painful experience - I've yet to encounter a developer who, after learning MVC, would ever choose to go back to WebForms for anything non-trivial.
The sane defaults (loss of ViewState, strongly-typed model binding, simple separation of concerns, real control over rendered HTML, testability) really make a big difference. In this case, I imagine tehhnbuz is referring to the "free" client/serve validation that you get out-of-box, which makes solving this problem trivial.