在MVC Core应用程序中创建母版页

use*_*784 0 asp.net-mvc master-pages

我保证我是MVC Core的新手(我只有一周的练习)我知道如何将主页添加到Dot net框架而不是MVC Core.谁能帮我?谢谢

Mr.*_*han 5

布局页面结构(Layout1.cshtml)

<!DOCTYPE html>  
<html>  
<head>  
    <meta name="viewport" content="width=device-width" />  
    <title>@ViewBag.Title</title>  
@RenderSection("head", false)  
</head>  
<body>  

     @Html.ActionLink("Home", "Index", "My") |   
     @Html.ActionLink("AboutUs", "AboutUs", "My") |   
     @Html.ActionLink("ContactUS", "ContactUS", "My") |   
     @Html.ActionLink("Facebook", "Facebook", "My") |   
     @Html.ActionLink("Twitter", "Twitter", "My")  

    <br />  
        @RenderBody()  
    <br />  

    Hello Nitin Pandit…………This is the demo of Layout pages.  

</body>  
</html> 
Run Code Online (Sandbox Code Playgroud)

在创建操作方法视图时设置视图的布局页面

@{
  Layout = "~/Shared/_Layout1.cshtml";
}
Run Code Online (Sandbox Code Playgroud)