Click here to Skip to main content
15,903,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am getting confused whether i need to use java script or asp validations in my asp web app
please suggest me which is better and efficient? and will reduce burden on the application?
Posted
Updated 15-Dec-13 23:33pm
v2

Both has its own advantages as well as disadvantages.But i(my opinion) suggest you not to depend on javascript validation itself.It can easily be disabled in browsers and it may leads to insert duplicate records.

There are not much difference in performance for both validation(s)

Refer here:
Understanding ASP.NET Validation Techniques[^]

Please see some good answers from these links:
http://stackoverflow.com/questions/7809275/javascript-validation-overwrites-asp-net-validators[^]
http://stackoverflow.com/questions/19534323/advantages-of-asp-net-validation-controls-over-javascript[^]
http://stackoverflow.com/questions/2869930/javascript-vs-asp-net-validation-which-one-to-choose[^]
 
Share this answer
 
v2
The type of Validation to be chosen depends upon the scenario for which you are building your application. You have to either negotiate in terms of security of performance. If security is a primary concern than you shall stick to Server side validation.

I personally recommend Server side validations If client-side validation is bypassed, your server-side validations come to rescue you from any potential damage to your server-side processing. In recent times, we have already heard lot of stories of SQL Injections and other sort of techniques that might be applied in order to gain some evil benefits.

On contrary client script validations optimize and enhance performance Client-side validation reduce the server-side round-trips so that the number of requests per user are considerably reduced.
 
Share this answer
 
Hi raxhemanth,

As Jas24 said, its not safe to depend on javascript validation
But you are asking about performance so javascript gives you more performance.
For instance if you implementing string name validation in client side and you succeed on it,(thats not enough)
now try to implement server side validation like this to get safer validation
C#
private bool isValidName(string name)
        {
            bool retBool = false;
            if (!string.IsNullOrEmpty(name)) //You can add your own condition
            {
                retBool =  true;
            }
            return retBool;
        }

Which ensures in server side also, so that no invalid data will be inserted into DB.
So its always safe to implement Client side and Server side validation.

Hope this helps you a bit.

Regards,
RK
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900