ArticleDirectory
- What you'll build
- Skills you'll learn
- Getting started
- CREATING YOUR FIRST APPLICATION
This tutorial will teach you the basics of building an ASP. net MVC web application using Microsoft Visual Web Developer Express, which is a free version of Microsoft Visual Studio. before you start, make sure you have the prerequisites listed above installed using the Web Platform installer.
You'll make your first ASP. net mvc web application usingVisual Web Developer 2010 ExpressAnd SQL Server Express. We'll make a little movie list application that will let us create and list movies.
A Visual Web Developer project with C # source code is available to accompany this topic.Download the C # version here. If you prefer Visual Basic, switch toVisual Basic versionOf this tutorial.
What you'll build
You'll implement a simple movie listing application. Below are two screen-shots of the application you'll build. It includes des a page that displays a list of movies from a database:
And you'll have a create form so you can add movies to the list.
Skills you'll learn
Here's what you'll learn:
- How to create a new ASP. net mvc project.
- How to create a new database using the Entity Framework Code-first paradigm.
- How to Create ASP. net mvc controllers and views.
- How to retrieve and display data.
- How to edit data and enable data validation.
Getting started
Start by running visual web developer 2010 Express ("Visual Web Developer" for short) and selectNew projectFromStartPage.
Visual Web Developer is an IDE, or integrated development environment. just like you use Microsoft Word to write statements, you'll use an ide To create applications. in visual web developer there's a toolbar along the top showing varous options available to you, as well as the menu you coshould also have used to create the project (File>New project).
CREATING YOUR FIRST APPLICATION
You can create applications using your choice of either visual basic or Visual C # as the programming language. For now, select Visual C # on the left and then selectASP. net mvc 3 Web Application. Name your project "mvcmovie" and then clickOK.
InNew ASP. net mvc 3 ProjectDialog box, selectInternet Application. LeaveRazorAs the default view engine.
ClickOK. Visual Web Developer used a default template for the ASP. net mvc project you just created, so you have a working application right now without doing anything! This is a simple "Hello world! "Project, and it's a good place to start your application.
FromDebugMenu, selectStart debugging.
Notice that the specified cut to start debugging is f5.
F5 causes visual web developer to start a development web server and run your web application. visual Web Developer then launches a browser and opens the application's home page. notice that the address bar of the browser saysLocalhostAnd not something likeExample.com. That's becauseLocalhostAlways points to your own local computer, which in this case is running the application you just built. when Visual Web Developer runs a web project, a random port is used for Web server. in the image below, the random port number is 43246. when you run the application, you'll probably see a different port number.
right out of the box this default template gives you two pages to visit and a basic login page. let's change how this application works and learn a little bit about ASP. net MVC in the process. close your browser and let's change some code.