Results 1 to 5 of 5

Thread: Which is the best method of Validating in web applicaiton...

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2007
    Posts
    38

    Which is the best method of Validating in web applicaiton...

    Hi all,

    Basically i am windows Programmer means working only desktop application. so entirely new to the web application. I have a basic idea about that. Can any one tell me how to handle the validation part in the web application (Asp.NET) like Client side validation using java script or Server side validation using the code behind or using Validator controls (javascript). Let me know which is the best method to achieve the performance and good programming techniques.

    Any suggestions and help would appreciated!!

    Thanks & Regards,

    Mahes

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Which is the best method of Validating in web applicaiton...

    Client side validation is useful since it saves the users of having to go through postbacks, but one of the rules of thumb is to not assume that it is the be-all and end-all for your validation. Never trust user input. So you must validate on serverside as well.

  3. #3
    Frenzied Member
    Join Date
    May 2006
    Location
    Toronto, ON
    Posts
    1,093

    Re: Which is the best method of Validating in web applicaiton...

    It's best to do as much client side as possible, since, as mendhak said, eliminating the need to go back and forth to the server is a timesaver.

    My general rule of thumb is that if it's quick and easy, do it on the client side with javascript, otherwise do it server side. Things like making sure that a textbox isn't empty or is at least 10 characters, I do on the client. Anything more complex, I do on the server.

    Even things like making sure something is formatted correctly, I like to do on the server. It's very possible and quite easy to do most of them client side, but it's far harder to debug and step through client side code than it is to do it on the server. Anything that requires more than a trivial application of logic should be put there.
    (VB/C#) is clearly superior to (C#/VB) because it (has/doesn't have) <insert trivial difference here>.

  4. #4
    Member
    Join Date
    Apr 2005
    Posts
    58

    Re: Which is the best method of Validating in web applicaiton...

    I agree. do client side validation first with "requiredFieldValidator", "customValidator" (asp.net 2005) controls and either set them to display the text error or use a validationsummary control which summarizes all the errors. These controls require some regular expressions.. just search the net for how to create reg exps... Also if you are using asp.net 2003 the validation controls dont work in FireFox. But google Dom validators... a guy created a dll that actually works in FF. the dll is called DomValidators.dll. As for server side validation, you need to do this a well. Protect your server/data/app!

  5. #5

    Thread Starter
    Member
    Join Date
    Aug 2007
    Posts
    38

    Re: Which is the best method of Validating in web applicaiton...

    Thanks for your valuable suggestion..

    It really helps me to work with the validation part in the web applications.

    Thanks & regards

    Mahes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width