client side validation vs server side validation

hello

 i see a web form that consists of three controls :textbox,requiredfieldvalidator that weired to the textbox and a button

within the click event of the button there is the following:

if page.isvalid then

response.redirect("Page is valid")

else

response.redirect("Page is not valid")

end if

according to my understandings:

when the user does not fill anything in the textbox and then clicks the button the the page will not be submitted (i.e no request to the page will be happened or no postback will be happened) then no server event will be happened so it is sure when the user submits the page so it will be valid so why the developer checks if the page is valid or not?

so i need to understand this topic

if any wrong in my understandings tell me please because i need to understand this concept

thank you for the help

0
wissam1
1/17/2006 5:33:04 AM
asp.net.client-side 24353 articles. 1 followers. Follow

6 Replies
1150 Views

Similar Articles

[PageSpeed] 21

That is slightly wrong. Unfortuantely the answer is not easy.

For ASP.NET 1.0 and 1.1
The javascript that is put onto the page to check its validity is only compatible with IE. This means that if you are using, e.g firefox, the javascript would not be put onto the page. The page would then postback even if the textbox was empty.
If you were using IE, then the page would not postback.


For ASP.NET 2.0
The javascript that is put onto the page to check its validity is meant to comform to the W3C standards, so should work on every browser. This means that no postback will occur.

For good web developing
No matter what happens, you should always do server side validation. Imagine if the user had javascript disabled.

Note:
I'm not sure, but I think ASP.NET 2.0 automatically does the server side validation for all controls except the custom control. Please correct me if I am wrong.

Jagdip

Intelligence is a burden.
Jagdip Singh Ajimal
Manchester (and yes, I am a Manchester United fan)
0
jagdipa
1/17/2006 11:04:44 AM
thank you for the support and for the help
0
wissam1
1/17/2006 11:45:35 AM
Consider reading this article on the subject of common misunderstandings about validation: 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
1/17/2006 5:22:41 PM
Hi Peter,

could you please clear something up for me.
In ASP.NET 2.0, lets say you have created a page with a requiredFieldValidatior on a textbox, and a button.
In the button's server side code, do you still need to check If Page.IsValid or does ASP.NET 2.0 now automatically do this for you?

i.e., do you write the same as ASP.NET 1.0/1.1:

Sub button1_click(....)handles button1.click
If Page.IsValid Then
......
End If
End Sub


or can you do:

Sub button1_click(.....)handles button1.click
'''''Validation automatically checked by ASP.NET 2.0 so dont need If clause
End Sub



Thanks

Jag

Intelligence is a burden.
Jagdip Singh Ajimal
Manchester (and yes, I am a Manchester United fan)
0
jagdipa
1/18/2006 9:42:34 AM

Hi,

in ASP.NET 2.0 you still have to make the if(Page.isValid) ...

in your example button1_click(.....) will fire if the user has JavaScript disabled, even if ASP.NET 2.0 do the server validation automatically.

the if(Page.isValid) statement allow you to customize what happens, stop executing code and write a message in a Label for example.

 


---
(If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)

Laurent Duveau
Silverlight MVP
http://weblogs.asp.net/lduveau/
0
Pluginbaby
1/18/2006 1:12:42 PM

Hi Jag,

You still must test Page.IsValid. Microsoft did not add code to their Button's OnClick method to skip calling your Click event handler if IsValid is false.


--- 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
1/18/2006 3:58:28 PM
Reply:

Web resources about - client side validation vs server side validation - asp.net.client-side

Cross-validation (statistics) - Wikipedia, the free encyclopedia
is a model validation technique for assessing how the results of a statistical analysis will generalize to an independent data set. It is mainly ...

Serena Williams eyes history, Caroline Wozniacki craves validation in women's US Open final
As Serena Williams eyes another slice of tennis history, Caroline Wozniacki is craving validation with a watershed US Open final triumph on Sunday ...

Travers Duncan asks High Court to strike down ICAC validation laws
ICAC could be sent back to the High Court as a challenge to new laws validating corruption findings looms.

Adam Scott proclaims Texas win as validation of No.1 ranking
... No.1 golfer, beating American Jason Dufner in the third hole of a play-off at the Colonial event. "It's a good feeling and maybe some validation ...

Hollande to sign gay marriage bill after Constitutional Council's validation
Hollande to sign gay marriage bill after Constitutional Council's validation People's Daily Online ... 26, 27, 28, 29, 30, 31. Jan, Feb, Mar, ...

Marketers, Get Ready for the 'Validation Era'
The public brands included has been engaging in a "friends" arms race. But there are signs that we know we overdid it.

Validation and Uncertainty
What an extraordinary conversation I had recently on Twitter. It started with Neil Killick’s statement that we should not consider our stories ...

Nvidia Icera 410 LTE Modem Passes AT&T Network Validation
... Today's news is a small step and logical precursor toward both goals, Nvidia's Icera 410 LTE and HSPA+ baseband has passed AT&T's network validation ...

Ting’s Q1 Subscriber Growth Suffers from Sprint’s New Unlocking Validation Process
Back in February, Sprint updated the process it uses to validate unlocked devices that customers want to utilize on other carriers or one of ...

[Android M Feature Spotlight] Stricter APK Validation Now Actually Checks If All Of An APK's Files Are ...
While you might file this one under "really? We weren't doing this already?" if you're a security expert, Google has added stricter validation ...

Resources last updated: 12/12/2015 2:00:42 AM