How much JavaScript code should be used in ASP MVC?

advertisements

I am new to the asp MVC programming. Since you can use jQuery/JavaScript code in the View, it seems to me you even can rarely put c# code in the Model/controller. This means most of the business logic is done by jQuery only, and this makes the website looks like a pure JavaScript coded project. If this is true, what's the deal to use C# to code in MVC framework?

If you think c# is easy to be maintained and developed, then how much code should be developed in c# compared with JavaScript in MVC framework? And in what situations should we use c# code in Model/controller rather than JavaScript in View?

Besides, what's the advantages of using asp MVC to develop websites compare with pure jQuery/jQuery QI developed websites?


jQuery/JavaScript in the view will run client-side and will not have access to server-side resources (unless it uses AJAX to retrieve those). C# code is server-side code. One is not a substitute for the other - instead they're complementary to each other.

Business logic in client-side may not be prudent (depends on your application and requirements) because:

  1. you may not want to expose your business logic to clientside as it can be viewed.
  2. it may create significant security gap if exposed.
  3. malicious client can manipulate clientside code and cause code to run with a different logic (some pricing attacks were done in that way in the past).
  4. and a few other reasons.