Monday, July 04, 2011

ASP.Net MVC Best Practices

ASP.Net MVC Best Practices
1. Create Extension Methods of UrlHelper to generate your url from Route.
2. Create Extension Method of UrlHelper to map your Javascript,Stylesheet and Image Folder
3. Abstract DI Container
4.Keep your controller free from HttpContext and its tail
5.Use UpdateModel Carefully
6. Avoid ViewData,user ViewData.Model(Say No to "Magic strings"
7. User PRG Pattern for Data Modification
8. Action Filters
Use ActionFitlers for "shared " data. Use Action filters to retrieve data that is shared among different views. Use Partial view to display them.
9. Write your own HTML . If there ia n if , write an HtmlHelper.
10 . Do not put javascript in you code
11. User JQuery and JQuery UI
12. Create new ActionResult if you need one.


No comments:

F12 Developer Tool is your friend.

I was recently debugging Web Site functionality issue with a client. We were not able to reproduce the issues at our end. I saw that the c...