Create an ASP.NET MVC5 application

Create the first ASP.NET MVC project. Use Visual Studio 2017/2019 to create an ASP.NET MVC5 application, the requirements are as follows:
(1) Select the "MVC" template to create an ASP.NET MVC application.
(2) Modify the contents of the homepage, about us and contact information pages respectively.
The page effect is shown in the figure:
Insert picture description hereHome page effect
Insert picture description hereAbout us effect
Insert picture description hereContact method effect
Practice ideas:

  1. Select menu "File" → "New" → "Project", and select "ASP.NET Web Application (.NET Framework)" in the pop-up "New Project" dialog box.Insert picture description here
  2. In the "New ASP.NET Web Application" dialog box, select the project template "MVC".
    Insert picture description here
  3. Open the homepage file /Views/Home/Index.cshtml, delete the default content, add "Hello! Everyone, this is my first ASP.NET MVC application!" div for the description text, and write the style appropriately ( Use the existing class style jumbotron of the project).
@{
    
    
    ViewBag.Title = "Home Page";
}

    <div class="jumbotron">
        <h2>Hello!大家好,这是我的第一个MVC。</h2>
    </div>
  1. Open the About Us file /Views/Home/About.cshtml, delete the default content, and add corresponding description text (refer to the default content, use h2 to write the title and p to write the description content).
@{
    
    
    ViewBag.Title = "关于我们";
}
<h2>@ViewBag.Title</h2>
<h3>@ViewBag.Message</h3>


  1. Open the contact file /Views/Home/Contact.cshtml, delete the default content, and add the corresponding description text (refer to the default content, use h2 to write the title and address to write the description).
@{
    
    
    ViewBag.Title = "联系我们";
}
<h2>@ViewBag.Title</h2>

<address>
    <div>地址:河北省唐山市丰南区正泰街29</div>
    <div>联系电话:0315-123456</div>
</address>
  1. Press the F5 shortcut key to start the application and browse the page.

Guess you like

Origin blog.csdn.net/m0_47675090/article/details/106236417