Monday, 23 November 2015

Short Description On Project Template In ASP.NET MVC 4

Short Description On Project Template In ASP.NET  MVC 4  

 
Empty: - The Empty template created the minimum references and resources required to run an Asp.net MVC application. As you can see in below image,  Models, Controllers, App_Data are completely empty folders and View folder only contains web.config and a Global.asax file and web.config. App_Start folder contains 3 configuration files ( FilterConfig.cs, RouteConfige.cs and WebApiConfig.cs ). 

 Basic: - It’s a new project type in MVC 4 and it was not available in MVC3. Basic project is much much closer structurally to Empty project in MVC3. It includes Contentand Scripts as well as few more references. Here is a short list of what’s included
jQuery
jQuery UI
jQuery Validation
modernizr
KnockoutJS
Antlr 3
Entity Framework
WebGrease
Bundling and minimization facilities have been prepared in this template. BundleConfig.cs file has been added to App_Start folder. Additionally, what had been disappeared in Views folder came back to the board. _Layout.cshtml includes the jQuery bundle as well as the default theme styling. 
 
 Internet Application :- Adds tow controllers( Account controller and Home controller)  to the Basic template with implemented actions and views.  Membership management functionality which allows you register, login, change password and so on is implemented in Account controller and Home controller gives you Index, About and Contact actions working with their own related views. Its a template used usually to start a normal web project in action.  
 

Intranet Application :- In fact, It’s  the Internet Application except for Membership management.  the Account controller and the web.config has been configured  to use Windows as it’s authentication method.
Mobile Application :-Mobile website programming is one of  most important feature in MVC 4 so this template has everything that Internet Application template has, however it  is using  jQuery.mobile instead.  
 
 Web API  Application :-Its another new Template in VS2012 to make it easy to develop RESTful web services and applications to feed a vast variety rage of clients from desktop browsers to tablet applications. It allows you to expose your data and service to the web directly over  Http. This template includes everything from Basic Template expect Account controller and membership functionality. 
 

Step by Step Creating ASP.NET MVC 4 Application - [Hello World] 

 1) Open the Visual Studio 2012 
 
 2) Select File-------->New------------------------>Project 
 3) A popup will be open, where you can see the list of all available templates for Windows and Web application. Select the Web application from the left hand side and also select the Template from the right hand side of the popup i.e. “ASP.NET MVC 4 Web Application”. Here you also provide the Proper application name and also select the folder where you save the application. 
 
 4) Select the “Ok” button, then after again a Popup will be open where you have to select the proper template for the application. Here in this case “Empty” Template is selected from the “Project Template”. 
 

 

 5) The Empty project will be open which is shown below 
 
 5) Now Right click on the “Controller” folder and then select Add------->Controller. A popup will be open where you give the appropriate name with suffix as a controller and click the add button. HelloWorldController class is opened

 6) Right click on the “Index” function in the “HelloWorldController” and select the “Add View…” option and click the “Add” button. 
 
7) “Index.cshtml” file is created inside the “HelloWorld” folder which is inside the “Views” folder. 
 
 8) Now Open the “Global.asax.cs” file and change the following code snipet 
routes.MapRoute(
               name: "Default",
               url: "{controller}/{action}/{id}",
               defaults: new { controller = "HelloWorld", action = "Index", id = UrlParameter.Optional }
           );
 9) Run the application by pressing the F5 key.
 

No comments:

Post a Comment