Automatic duplication of business logic on the web client

Last week, I implemented date checking in our interface, a combination of ASP.NET and heavily dependent on a lot of JavaScript code, to avoid parallel server trips until the form is saved. I felt unsure that this rule check is not performed on the server, but our current architecture and performance requirements prevent this. This is out of my hands at the moment.

Ideally, this check should be performed in both places, but then the server-side check will be performed with neat, typed, C # and will immediately be visible to the developers working on this BO, and the client-side check is actually not even performed as a copy, which is quirky but completely different code.

What are the ways to duplicate server-side validation on the client? Using the rules engine and having the same rule applied by the two trusted rule mechanisms on each side, the delegation of the server check is actually performed using JavaScript, which is then registered in the rendered client, it looks like another option, but it seems complicated.

Any ideas on this rather academic and practical matter?

+2
source share
6 answers

I never did this, but it looks like you could write your verification code in one place on the server, and then your web application immediately got access to the verification code, while each client page accesses the same web service using AJAX .

.NET- , -. AJAX- - ( : - ).

0

ASP.NET .

ASP.NET : . - , , , ( ). , . . / !

http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=46

. , ( , ). , html.

+2

, ,

  • (javascript vs. #) .
  • ,

. , , . Ajax WebRequest, .

+1

, - . , , .

, ( #) JavaScript (, -, , ).

- ( Microsoft).

0

: MVC - DRY - ?

, , - , , MVC, , .

0

, , , . , - -. . , , , -, , firstName, .

, - , , - ( ) .

- (, , ) ui- , . UI , , ( ) . (UX), .

, , , . , . - , , , , ... . , 10. , , , . , , , , .

So, if this is a scenario in which you have a binding to these two types of verification, then it is better to use verification on the service side, as well as on the client side, you transmit information (asynchronously) for servicing and returning the result back. Something like this is a third-party decision . If you have a combination of these validations in one scenario, then I would not even bother to split them only on the user interface and service checks, for the whole test I would go to the service.

0
source

All Articles