When to use client side varidation and server side varidation in .net?

In .net or classic web application we can varidate user data either on client isde or server side. How to select which side varidate to be used? Thanks!
0
zhao790
11/18/2005 4:50:44 PM
asp.net.getting-started 91979 articles. 2 followers. Follow

3 Replies
624 Views

Similar Articles

[PageSpeed] 43

Generally, I use both client and server validation. I make sure the input is in the correct format and reasonably valid on the client, then I verify the data on the server. The extent of validation also depends on the type of data that I need to validate.

Here are a few references:
Validating ASP.NET Server Controls
Introduction to Validating User Input in Web Forms
Client-Side Validation for ASP.NET Server Controls
Security Checklist: ASP.NET 2.0
Validation ASP.NET Controls

Hope this helps.

-- Erik Reitan
ASP.NET User Education
This posting is provided "AS IS" with no warranties, and confers no rights.

0
erikreitan
11/22/2005 12:10:46 AM

As a rule, always use server side validation because not all browsers support the client-side validators. (In fact, in ASP.NET 1.x, only IE and IE/Mac support it.) Offer clientside validation to improve performance by avoiding postbacks.

Please see this article on many questions users have with the Microsoft validators: http://aspalliance.com/699.


--- Peter Blum
Creator of Peter's Data Entry Suite (formerly Professional Validation And More and Peter's Date Package) and Peter's Polling Package
www.PeterBlum.com
0
PLBlum
11/22/2005 8:53:51 PM
Never rely on client-side validation alone. Use it only as an added
convenience for users (faster feedback) but always code your
server-side scripts as if there was NO client side validation. 
0
kufu
11/23/2005 12:47:43 AM
Reply:

Similar Artilces:

Validation Controls in .NET ( Client side or server side?)
 i have a very basic question. We have all these validation controls in asp.net ( required field, range validator and others)..my question is the required field validator is a server side control. So does that mean that it does a post back?..is it client side or server side control  The only controls that post back are buttons and other inputs where you set AutoPostback="True", such as a dropdownlist or a textbox.  Another way of posting back is using an UpdatePanel and placing a trigger in it for a specified control and/or event. All controls are considered clien...

Jscript, moving from client-side to server-side (.NET)
Hey all I’m working translating a web-app written in client-side Jscript to run on the server-side as JScript.NET. Without needing to get too specific, I am using Jscript because the original page aggregated raw data to produce statistical results (this was done dynamically based on user 'sort-by' options). The final output is an html report that can be emailed. Because this is currently being done on the client side, as the raw data grows the load-time grows as well (to the point that has almost become unusable). I’m posting here to see if anyone has any experi...

communication between client side(java script) and server side in .net project
I have a question which is, when building a .net project, we are able to use server side code and client side code(java script). How do they communicate? Thanks Client Side coding works with the WebBrowser. So when ever you write client side code you have to keep browser compatability in your mind and you have to code. Server Side code works with Web Server (IIS) and it's ASPNET ISAPI's. The won't directly communicate with each other. But using AJAX you can all server side code from Client Side! Example article on Ajax@ http://www.devarticles.com/index2.php?option=content&task=...

how do i get selectedValue of drop down list server side if i am populating it using client side javascript?
 Hi All.I am populating a drop down list client side using: The drop down list is populated based on a selection of another drop down list. ddlList.options[i] = new Option(1,2); as an exampleThe populating is done as i need it to. However, a button click event i am trying to get the selectedValue of the ddlList. However, it doesn't give me it. It only gives me the selectedValue of the drop down list on first rendering. Any ideas on how i can get it?   Could You paste some code? That would be helpful. Thanks S@ss (Shashi Shekhar Singh)My BlogPlease mark a post as ANSWER ...

when to use client side / server side?
Hey, Please can someone tell me when do i need to use a client-side or a server-side? For instance, I have a dropdownlist and when the user choses one of the listitems then click on the button to submit changes,i need first to validate the new value chosen by the user by comparing it with the old value and then redirect the user to the next page if there are no errors or view an error on the other hand! so in this case what's more preferable to use a JScript (client side) or on the click event of the button pressed (server side)! waiting the reply................. thanx in adva...

Local Client-side printing using server vb.net code?
Hi,Rather than use the window.print() command which is just a form dump.  I want to use vb.net code to do this as it has all the features necessary.I came across this useful article from developers.com.  http://www.developer.com/net/net/article.php/3102381However, when I run this it throws an exception because there is no default printer attached to the server.  Of course I don't want to print server side - thats no good.  But print client side.  The users would print to whatever print queue on the network they have connected to their own pc.I thought ...

Getting my client-side variable over to server-side
Ok so I have looked at a few posts on this subject and I can't quite figure out how to apply the idea to what I am doing here. I am using javascript to take amounts from 7 different textboxes and add them up on the fly, dropping the total in the 8th textbox. After they fill in that information they click button (postback) to continue throughout the form... what I need is for the "textboxTotalAmt" to move from client-side to server-side.  So I can access that total amount later in the form. Here is the Javascript piece... <script type="text/java...

Firing both Client side event and server side event for server side button
I am having some difficulties getting this to work.. I have button_click (Asp.net) and ClientClick (Javascript).  Javascript is firing fine.  Server script is not. may be you have return return false in the in the javascript which is why its not firing server side event.You should add javascript evelt like thisbutton1.onclientclick = "functionname" Function should nopt return false. Vikram www.vikramlakhotia.comPlease mark the answer if it helped you...

How to use client-side script(javascript) in DNA using .Net Remoting
Hi all,     It was known that SAO and Singleton object about .Net Remoting. When I Create an object in server side and hosting in IIS's virtual directory,I want to use javascript asynchronous invoking the remote object by HTTP channel, 80 port and SOAP formatter just like XMLHTTP invoking web service. My code as following, <script> objXmlDoc = new ActiveXObject("Msxml2.DOMDocument"); objHttp = new ActiveXObject("Msxml2.XMLHTTP"); strEnvelope = ?? objHttp.onreadystatechange = function() { ...... }   szUrl = "http://ServerNa...

Side by Side Execution of .net v1.1 and .net v2.0
Hi i am new bie to asp.net 2.0.Till date i have been developing projects using VS.Net 1.1 and now i hv decided to upgrade to new version 2.0.Now i want to run and develop my projects using any of the versions as desired.My question is that can i install vs 2.0 without updating the previous version and will i be able to develop and run my applications in any of the versions as desired.i have been known that we can run these versions side by side(i.e. one application can use 1.1 and other 2.0),but can we do side by side development as well(i.e. one application can use 1.1...

How to get innerText from IFrame (on server-side / on client-side)
Hi, is there some posibility how to read inner text from IFRAME on server-side ?I've tested it with innerText and InnerHtml but it doesnt work I also tested it on client-side with JavaScript but I'm still not able to read innerText or innerHTML of that frame. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="AJAX_Test.WebForm1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title&...

How to get the Client side values in server side code.
Hi all, i have a proble i need to get the client side javascript values in C# code at server side. how can i pass those values? i am using version 1.1, i kno thatwe can use callback events mechnisam in 2.0 or ajax ,apart from that how we can pass? My problem is i need to stop the execution of the code based on after reciving values from the client   any ideas please???   Million thanks RamCheersRam MCP Hello Ram, a common approach is from javascript set an hidden field, then issue a postback. On the server-side, handle the post-back. Feel free to go deeper in your que...

Client side clock using server side controls
Is it possible to create a client side clock using a server side control (label or textbox) in C# without accessing JavaScript?  If so, how? In principal it is possible, it depends how often you need to reload this clock ... if every second than: 1. It is no sens to do I mean 2. You need than to make setTimeout client script, to refresh page every second With FastPage it seems more real task ... http://fastpage.more.at...

get server side datetime but run at client side
How do I get the server side datetime eg( 4 Aug 2006  6:12 : 01(seconds) AM  ) which the time is something similiar to ticking clock, once it get the server side datetime, it will pass to the javascript. From javascript it will increment the second by one, it is just similiar to ticking clock, after 10 seconds it will synchronize to the server datetime which means it get the latest server side datetime.   Is there any guide ? thanks in advance!!!kiwi_cyh Hi, It seems you want to synchronize the time in client side display with the server. You can use asynchronous clie...

Web resources about - When to use client side varidation and server side varidation in .net? - asp.net.getting-started

Resources last updated: 11/25/2015 6:10:41 PM