The first introduction of the MVC4 website creation tutorial, The mvc4 Introduction

Source: Internet
Author: User

The first introduction of the MVC4 website creation tutorial, The mvc4 Introduction

I heard that Win8 and v2012 were released, and the system was reinstalled today.

I think the interface is still good.

After installing vs2012 and learning mvc4, I did not find the Vs2012 Professional version. Download Express for Web, which is a genuine version!

Download 509M soon and install it.

After installing the interface, it seems that there are many differences with vs2010.

One brother said that the best way to learn is to complete a little thing independently. Let's prepare to learn to be a small website. The name is just a bit better and it is called NineskyCMS. The CMS name is corrupted, I also followed suit, hoping I could finish it myself.

Learning officially started:

Open VS Express for Web-> Create a project

Next step

OK. Wait a moment to create the project.

Let's take a look at the solution Resource Manager, which is quite different from the folders generated by mvc3.

Run the command to check the effect.

The interface is very good.

Folder structure does not like Transformation:

Delete InitializeSimpleMembershipAttribute under Filters;

Delete the Images folder

Delete AccountController. cs under Controllers;

Delete WebApiConfig. cs under App_Start

Open the RouteConfig. cs File

routes.MapRoute(name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); 

Change action = "Index" to action = "Default ". I prefer Default;

1. Open HomeController and change public ActionResult Index () to public ActionResult Default (). Delete public ActionResult About () and public ActionResult Contact ();

2. Change the Content folder to Skins. The modified style is as follows:

Modify BundleConfig. cs as follows:

Namespace CMS {public class BundleConfig {// For more information about Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725public Static void RegisterBundles (BundleCollection bundles) {bundles. Add (new ScriptBundle ("~ /Bundles/jquery "). Include ("~ /Scripts/jquery-{version}. js "); bundles. Add (new ScriptBundle ("~ /Bundles/jqueryui "). Include ("~ /Scripts/jquery-ui-{version}. js "); bundles. Add (new ScriptBundle ("~ /Bundles/jqueryval "). Include ("~ /Scripts/jquery. unobtrusive *","~ /Scripts/jquery. validate * "); // use the development version of Modernizr for development and understanding. Then, use http://modernizr.com To select only the required test. Bundles. Add (new ScriptBundle ("~ /Bundles/modernizr "). Include ("~ /Scripts/modernizr-* "); bundles. Add (new StyleBundle ("~ /Skins/css "). Include ("~ /Skins/Default/Style.css "); bundles. Add (new StyleBundle ("~ /Skins/jquery-ui/css "). Include ("~ /Skins/jquery-ui/jquery.ui.core.css ","~ /Skins/jquery-ui/jquery.ui.resizable.css ","~ /Skins/jquery-ui/jquery.ui.selectable.css ","~ /Skins/jquery-ui/jquery.ui.accordion.css ","~ /Skins/jquery-ui/jquery.ui.autocomplete.css ","~ /Skins/jquery-ui/jquery.ui.button.css ","~ /Skins/jquery-ui/jquery.ui.dialog.css ","~ /Skins/jquery-ui/jquery.ui.slider.css ","~ /Skins/jquery-ui/jquery.ui.tabs.css ","~ /Skins/jquery-ui/jquery.ui.datepicker.css ","~ /Skins/jquery-ui/jquery.ui.progressbar.css ","~ /Skins/jquery-ui/jquery.ui.theme.css "));}}

1. Delete Vies/Account and Vies // Home/About. cshtml, rename Index. cshtml is Default. cshtml, delete Shared/_ LoginPartial. cshtml. cshtml: delete Views/_ ViewStart. cshtml

2. Open the web. config modify the database connection to <add name = "DefaultConnection" connectionString = "Data Source = (LocalDb) \ v11.0; Initial Catalog = NineskyCMS; Integrated Security = SSPI; attachDBFilename = | DataDirectory | \ NineskyCMS. mdf "providerName =" System. data. sqlClient "/>

OK! The world is finally quiet!

The final interface is as follows:

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.