4 Best Practices for ASP.NET MVC Application

Published on March 8, 2013 by abundantcode

Filed under ASP.NET MVC

Last modified March 8, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 3814 times

There are plenty of best practices for ASP.NET MVC Application which can be followed by the ASP.NET MVC Project developer.

In this blog post , we will cover 4 of the best practices when developing ASP.NET Web Applications.

4 Best Practices for ASP.NET MVC Application

1. Request Validation

The Request Validation is one of the features in ASP.NET MVC which is enabled by default and prevents the potential dangerous content to be submitted.

If you need to send the HTML markup tags in your controller , you might want to disable the Request Validation feature with the [ValidateInput(false)] attribute on top of the Action method.

2. Strongly Typed Models

ViewBag , ViewData and tempData are definitely useful in ASP.NET MVC but the strongly typed models should be preferred when binding to UI which has its own advantages.

3. Caching Data

The Application’s performance can be improved with the caching mechanism to en extent. To enable the caching for the model , just add the attribute [OutputCache(Duration=3600)] to the action.

4. Data Annotations and Validations

Validations are important aspect of the ASP.NET Web Application . The validation will enable the user to allows only the data being entered in the UI. The developers can utilize the DataAnnotations class and apply attributes on each properties of the model in order to apply validations.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

1 Comment

  1. Interesting .NET Links – March 9 , 2013 | TechBlog
    March 9, 2013 - 7:47 pm

Leave a Comment


You might be Interested in these Posts

How to read a connection string from web.config file in ASP.NET ?

Assume that you have a connectionstring configured in the web.config file of your ASP.NET applicatio...

Could not load file or assembly … An attempt was made to load a program with an incorrect format (System.BadImageFormatException)

There are times when you might get the following error when running the application from Visual Stud...

Top 10 JavaScript Drawing Libraries

Are you a Web developer and looking for the drawing libraries in JavaScript ?. In this blog post , w...