Monday, October 28, 2013

ASP.NET MVC



Best Practice

  • Put validation logic to "view model" instead of your business model - Link
  • Automapper improve productivity but slow, use with care
  • Entity Framework Patterns - Link1 Link2

Security tips for security (ref link )
  1. Anti-Forgery-Token (attribute) on the login page
  2. Slow all authentication attempts down by at least a second (makes brute force impractical)
  3. Implement an account lock out procedure on n amounts of invalid logons
  4. Always use a generic error message on your failed logins to prevent hackers knowing which part of a login is wrong
  5. Always encrypt your passwords in the db with a salt, the salt should be per user to prevent a rainbow attack on a stolen database
  6. Always make sure that any data displayed or retrieved is valid for that user
  7. Always use parameterised sql
  8. Try and obfuscate the ids passed around in your urls and views to prevent modification or an attempt at a direct reference attack
Components
  • Elmah
  • Glimpse
  • Ninject (https://github.com/ninject/ninject/wiki/_pages)
  • WebMatrix - SimpleMembershipProvider
  • WebActivator
  • OAuth
  • EntityFramework
  • Javascript Libs
    • JQuery UI
    • Kendo UI
    • http://www.nuget.org/packages/Google.DiffMatchPatch.Js/
    • Knockout
    • Backbone 
  • Bundle
Concepts
  • Routing
  • ViewModel
  • Validation
  • Model Binder
  • Bundle
  • Partial View
  • Child Action
  • Filter
  • View Engine
  • Controller Factory
  •  

Questions and Answers