`
suizhikuo
  • 浏览: 28927 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ASP.NET MVC 3 (Intro to ASP.NET MVC 3) (1/9)

 
阅读更多

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:

MoviesWithVariousSm

And you'll have a Create form so you can add movies to the list.

CreateFormSo

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.

分享到:
评论

相关推荐

    AccessControlHelper:用于asp.net mvc和asp.net核心的AccessControlHelper,基于策略的授权

    项目基于 .NETStandard,同时支持 asp.net mvc(.NET faremwork4.5以上) 和 asp.net core 项目(asp.net 2.0以上),基于 ASP.NET MVC 和 ASP.NET Core 实现的对 Action 的访问控制以及页面元素的权限控制。...

    Intro-to-ASP.NET-MVC-4.zip_.net编程_C#_

    这个“Intro-to-ASP.NET-MVC-4.zip”压缩包包含的是官方提供的ASP.NET MVC 4教程源代码,旨在帮助开发者理解和掌握这一强大的Web应用程序开发技术。 ASP.NET MVC 4 的核心特性包括: 1. **模型-视图-控制器(MVC)...

    Intro_ASP.NET.rar_control

    **ASP.NET基础概念详解**...结合.NET Framework的其他特性,如ASP.NET MVC和ASP.NET Core,开发者能够构建高性能、可扩展的现代Web应用。通过深入理解这些基本概念,开发者可以更好地掌握ASP.NET的精髓,提高开发效率。

    C#实现MVC设计模式,源码

    C#实现MVC设计模式,虽然这个设计很简陋,可重用价值有限,但至少这是个MVC的设计模式,现在很难看到真正MVC的设计了, 很多人把asp.netMVC当作MVC, 要知道这篇文章是2005年发表的,原文: ...

    IntroToASP.NetMvc4WithVisualStudioBeta.pdf 英文原版

    Intro To ASP.Net Mvc 4 With Visual Studio Beta

    asp.net core利用AccessControlHelper实现控制访问权限

    由于项目需要,需要在基于 asp.net mvc 的 Web 项目框架中做权限的控制,于是才有了这个权限控制组件,最初只是支持 netframework,后来 dotnetcore 2.0 发布了之后添加了对 asp.net core 的支持,在 dotnetcore 3.0...

    微软.NET程序员高级培训教程资料2

    1. **aspnet-module5** 和 **aspnet-module6**:这部分内容可能涉及到ASP.NET框架的模块,如MVC(模型-视图-控制器)架构、路由、依赖注入、身份验证和授权,以及性能优化等高级主题。 2. **aspnet-ntroduction**:...

    Aspnet-SQLiteBuddy.zip

    使用ASP.NET Core 2.1 MVC.Intro构建,asp.net是一个开源的web框架,用于使用.net构建现代web应用和服务。asp.net创建基于html5、css和javascript的网站,这些网站简单、快速,可以扩展到数百万用户。

    intro_mvc:MVC 框架介绍,适用于 Girl Develop It Philadelphia

    - 后端MVC框架如Ruby on Rails、ASP.NET MVC和Spring MVC则主要用于服务器端,处理HTTP请求,执行业务逻辑,与数据库交互,并生成响应返回给客户端。JavaScript在这里通常用于客户端脚本,实现页面交互和AJAX请求。...

    javaServer Faces 技术架构与应用.pdf

    ### JavaServer Faces (JSF) 技术架构与应用 #### 一、JavaServer Faces (JSF) 简介 JavaServer Faces (简称 JSF) 是一种基于Java的Web应用开发框架,专为构建...- [OpenXUL Alliance](http://xul.sourceforge.net/)

    ef7-app-sample

    - ASP.NET Core教程:https://docs.microsoft.com/zh-cn/aspnet/core/data/ef-mvc/intro - Stack Overflow上的相关问题:https://stackoverflow.com/questions/tagged/entity-framework-core 通过"ef7-app-sample...

    aspnetcore 实现简单的伪静态化功能

    Intro 在我的活动室预约项目中,有一个公告模块,类似于新闻发布,个人感觉像新闻这种网页基本就是发布的时候编辑一次之后就再也不会改了,最适合静态化了, 静态化之后用户请求的就是静态文件基本不再需要服务器端...

Global site tag (gtag.js) - Google Analytics