ASP. NET mvc4 Getting Started Guide (1): getting started

Source: Internet
Author: User
Preface

This tutorial describes how to use Microsoft Visual Studio express 2012 or visual web developer 2010 Express Service Pack 1 to create an ASP. NET mvc4 web application.ProgramThe basic knowledge required. We recommend that you use Visual Studio 2012. You do not need to install any components to complete this tutorial. If you are using Visual Studio 2010, you must install the following components. You can click the following link to install all required components:

    • Visual Studio Web Developer express SP1 prerequisites
    • WPI installer for ASP. net mvc 4
    • Localdb
    • Ssdt

If you are using Visual Studio 2010 instead of Visual Web Developer 2010, you need to install WPI installer for ASP. net mvc 4 and Visual Studio 2010 prerequisites

C # example in this articleSource codeIs a visual web developer project: Download the C # sample source in this articleCode.

What kind of applications will be built in this example?

You will implement a simple movie list application that supports creating, editing, searching, and selecting a movie list from the database. The following are two screenshots of the application you have built. This page displays the list of movies selected from the database:

The application also allows you to add, edit, and delete movies and display details of a single record. All user data input scenarios contain data verification logic to ensure that the data stored in the database is correct.

Getting started

Run Visual Studio express 2012 or visual web developer 2010 express to start this example. Most Visual Studio express 2012 screens are used in this series, you can also use Visual Studio 2010/SP1, Visual Studio 2012, Visual Studio express 2012, or visual web developer 2010 express to complete this tutorial. Slave"Start"Page, select"Create a Project".

Visual Studio is an integrated IDE development environment. Just as if you use Microsoft Word to write documents, you can use the integrated development environment (IDE) to create an application. Different options are displayed in the top toolbar of Visual Studio for your use. There is also a menu in IDE that provides another way to execute tasks. (For example"Start"Page, select"Create a project", You can use this menu, and then select"File">"Create a project")

Create your first application

You can use Visual Basic or C #Programming LanguageTo create your application. Select Visual C # on the left, and then selectASP. net mvc 4 WebApplications. Name your project as "mvcmovie", and then clickOK.

InNewASP. net mvc 4ProjectIn the dialog box, selectInternet applications. UseRazorAs the default view engine.

ClickOK. The ASP. net mvc project created in Visual Studio uses the default template, so you do not need to do anything in the current project! This is a simple "Hello world! "Project, and this is also a good place for you to start the" mvcmovie "project.

SlaveDebuggingIn the menu, selectStart debugging.

Note that you can also use the keyboard shortcut F5 to start debugging.

F5 enables Visual Studio to start IIS express and run web applications. Visual Studio then starts the browser and opens the main page of the application. Note that the address bar of the browser displays localhost instead of example.com. This is because localhost is always resolved to your local computer. In this case, this is the application you just created. When Visual Studio runs a web project, a Web service with a random port is used. In the image below, the port number is 41788. When you run the application, you may see a different port number.

On the right side of the default template page, the "home", "about", and "Contact" pages are provided. It also provides registration and login functions, and links to Facebook and Twitter. The next step is to modify the default application and learn about ASP. net mvc. Close the browser and let's modify some source code.

 

Download the complete document:ASP. NET mvc41_1_timeout

 

Certificate -----------------------------------------------------------------------------------------------------------------------------------------------

Note:

9 articles in this seriesArticle, Translated from ASP. net mvc4 official tutorial, due to the concise description of this series of articles, the length is moderate, from an example to explain, the full text finally completed a small system for managing movies, very suitable for beginners ASP.. Net mvc4. Nine articles:

1. Introduction to ASP. NET mvc4

· Original address: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/intro-to-aspnet-mvc-4

· Address: http://www.cnblogs.com/powertoolsteam/archive/2012/11/01/2749906.html

2. Add a controller

· Original address: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-controller

· Address: http://www.cnblogs.com/powertoolsteam/archive/2012/11/02/2751015.html

3. Add a view

· Original address: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-view

· Address: http://www.cnblogs.com/powertoolsteam/archive/2012/11/06/2756711.html

4. Add a model

· Original address: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-model

· Address: http://www.cnblogs.com/powertoolsteam/archive/2012/12/17/2821495.html

5. Access the data model from the Controller

· Original address: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/accessing-your-models-data-from-a-controller

· Address: http://www.cnblogs.com/powertoolsteam/archive/2013/01/11/2855935.html

6. Verify the editing method and view

· Original address: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/examining-the-edit-methods-and-edit-view

· Address: http://www.cnblogs.com/powertoolsteam/archive/2013/01/24/2874622.html

7. Add new fields to the movie table and Model

· Original address: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-new-field-to-the-movie-model-and-table

· Translation address:Http://www.cnblogs.com/powertoolsteam/archive/2013/02/26/2933105.html

8. Add a validator to the Data Model

· Original address: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-validation-to-the-model

· Address: http://www.cnblogs.com/powertoolsteam/archive/2013/03/05/2944030.html

9. query details and delete records

· Original address: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/examining-the-details-and-delete-methods

· Address: http://www.cnblogs.com/powertoolsteam/archive/2013/03/07/2948000.html

10. Third-party control studio for ASP. NET wijmo mvc4 tool Application

Address: http://www.cnblogs.com/powertoolsteam/archive/2013/05/09/3068699.html

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.