If you find this article useful, consider making a small donation to show your support for this web site and its content.
Free app Developer Interview available here.

Available on the iPhone App Store
Available on the Google Play
AboutMe
About me:
Hi. My name is Farooq Kaiser and I'm a software developer from Toronto, Canada.



ASP.NET MVC application structure

by Farooq Kaiser 3. July 2009 05:18
In this tutorial we will explore ASP.net MVC application structure. When we create an ASP.NET MVC Web application project, MVC components are separated based on the project folders. Follow the these steps.
  1. Launch Visual Studio 2008 by selecting All Programs Microsoft Visual Studio 2008 from the Start menu. 
  2. Select File  New  Project... from the main menu to open the New Project dialog.
  3. Then select the "Web" node on the left-hand side of the dialog and then choose the
    ASP.NET MVC Web Application" project template on the right:

  4. Press the OK button and then next dialog box will appear for unit test project.



  5. Press the OK button and then Visual Studio will create a solution
    with two projects in it - one for web application and one for unit tests:

        ASP.NET MVC project creates the following folder structure:


Controllers

This folder contains Controller classes that handle URL requests

Models

This folder contains classes that represent and manipulate data

Views

This folder contains UI template files that are responsible for rendering output

Scripts

This folder contains JavaScript library files and scripts (.js)

Content

This folder contains CSS and image files, and other non-dynamic/non-JavaScript content

App_Data

This folder contains data files you want to read/write. 

The test project has a Controllers folder that contains the HomeControllerTest class.
This class has a unit test for each HomeController action method (Index and About).
 

These default files added by Visual Studio provide us with a basic structure for a working application
- complete with home page, about page, account login/logout/registration pages.

Now we can run the project by choosing either the Debug->Start Debugging or Debug->Start Without Debugging menu items:

It will launch the basic application as shown below.

Summary 

In this article, we explored the ASP.net MVC application structure. In next article we will create a MVC sample application.

Currently rated 2.3 by 3 people

  • Currently 2.333333/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

asp.net


comments powered by Disqus

Comments

Jobs Autos Real estate Videos Power by Google