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 using Visual Web Developer 2010 Express and 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 to the Visual Basic version of 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 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 select New Project from the Start page.
Visual Web Developer is an IDE, or integrated development environment. Just like you use Microsoft Word to write documents, you'll use an IDE to create applications. In Visual Web Developer there's a toolbar along the top showing various options available to you, as well as the menu you could 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 select ASP.NET MVC 3 Web Application. Name your project "MvcMovie" and then click OK.
In the New ASP.NET MVC 3 Project dialog box, select Internet Application. Leave Razor as the default view engine.
Click OK. 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.
From the Debug menu, select Start Debugging.
Notice that the shortcut 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 says localhost
and not something like example.com
. That's because localhost
always 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.
分享到:
相关推荐
ASP.NET MVC V1.0 Detailed intro
项目基于 .NETStandard,同时支持 asp.net mvc(.NET faremwork4.5以上) 和 asp.net core 项目(asp.net 2.0以上),基于 ASP.NET MVC 和 ASP.NET Core 实现的对 Action 的访问控制以及页面元素的权限控制。...
C#实现MVC设计模式,虽然这个设计很简陋,可重用价值有限,但至少这是个MVC的设计模式,现在很难看到真正MVC的设计了, 很多人把asp.netMVC当作MVC, 要知道这篇文章是2005年发表的,原文: ...
根据文章《Introduction to Model View Control (MVC) Pattern using C#》编写的程序源码,可以用来学习MVC,文章链接...其他用户翻译后文章地址http://www.cnblogs.com/c-delight/archive/2005/12/27/305694.html
Intro To ASP.Net Mvc 4 With Visual Studio Beta
ASP.Net 基礎概念 :運作原理, Server Control, Data Control...
official MVC .net source code
由于项目需要,需要在基于 asp.net mvc 的 Web 项目框架中做权限的控制,于是才有了这个权限控制组件,最初只是支持 netframework,后来 dotnetcore 2.0 发布了之后添加了对 asp.net core 的支持,在 dotnetcore 3.0...
该架构已踩过大部分坑,文章地址:https://blog.csdn.net/randy521520/article/details/136151322 在使用该架构前请确保已安装node、yarn工具,node版本18+,此项目构建主要集成:axios、pinia、vant、sass、vite、...
该架构已踩过大部分坑,文章地址:https://blog.csdn.net/randy521520/article/details/136544929 在使用项目前请确保已安装node、yarn工具,node版本18+,此项目构建主要集成:axios、antd、sass、vite、sass、vue3...
asp.net mvc intro. ( a sample application).
该架构已解决大部分坑,文章地址:https://blog.csdn.net/randy521520/article/details/136150494 在使用项目前请确保已安装node、yarn工具,node版本18+,此项目构建主要集成:axios、pinia、vant、sass、vite和vue...
该架构已解决大部分坑,文章地址:https://blog.csdn.net/randy521520/article/details/136151816 在使用项目前请确保已安装node、yarn工具,node版本18+,此项目构建主要集成:axios、antd、sass、vite、sass、vue3...
intro to computation theory
.NET Core Runtime ( CoreRT ) 是 .NET 本机工具链,目前能够运行在 Windows 和 Linux 上。 C9 介绍视频 https://channel9.msdn.com/Events/Visual-Studio/Connect-event-2015/104 介绍文档 ...
Book of Fundamental of computer engineering
对应的书本源码下载请从大神github https://github.com/QianMo/OpenCV3-Intro-Book-Src 或者百度硬盘https://pan.baidu.com/s/1c2Mqdw?errno=0&errmsg=Auth Login Sucess&&bduss;=&ssnerror=0&traceid;=#list/path=/...
Intro to Hibernate TCJUG Intro to Hibernate TCJUG Intro to Hibernate TCJUG
asp.net core 的运行是一个又一个的中间件来完成的,因此我们只需要定义自己的中间件,记录请求开始处理前的时间和处理结束后的时间,这里的中间件把请求的耗时输出到日志里了,你也可以根据需要输出到响应头或其他...
http://ocw.mit.edu/courses/mathematics/18-06-linear-algebra-spring-2010/ 处可得更多课件/在线视频