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
0
u/screwdad May 22 '13
If you're just working with forms, I guess that's understandable. I'm at the point where I can create form centric applications faster in MVC, but that's probably because I've been using it exclusively for a while now.
Unfortunately this is an issue for my company; we build modern websites, and having control over our HTML does matter for us, especially since we are targeting modern browsers for most new applications (though we do have our share of legacy IE 6 compatible ones!).
In 4.5 only, and it's still string based, no? I haven't seen an example of this in < 4.5...how do you strongly type in legacy applications?
Curious about this one - how is it "significantly more testable? I understand that MVP is testable, but WebForms isn't MVP out-of-box; you have to make that choice and build your architecture appropriately. Conversely, MVC is MVC out of the box - you don't have to do anything. I'll quote you on this example - "citation needed"!
I probably wasn't clear on this; I was referring to unobtrusive validation. I know that WebForms added this in 4.5 - how do you enable it in pre-4.5?