Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi The file Layout.cshtml in path:
Views -> Shared -> _Layout.cshtml
Is like below:
Is this file as same as MasterPage file in ASP.Net classic?
Now I wants to put a logo of my company, at top of pages. What should I do? And put information of my company in footer of pages.
Thanks.

HTML
<pre>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - </title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    <script src="~/Scripts/jquery-3.4.1.js"></script>
    <script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
    <script src="-/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    

</head>
<body>
    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li>@Html.ActionLink("Home", "Index", "Home")</li>
                    
                </ul>

            </div>
        </div>
    </div>

    
    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>© @DateTime.Now.Year - <span style="color:aqua"><a href="http://www.Besat.ir" target="_blank">my company information</a></span></p>
        </footer>
    </div>



    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)
</body>
</html>


What I have tried:

i don't know what i should do.
.......................
help please.
Posted
Updated 21-Mar-20 4:13am
Comments
F-ES Sitecore 21-Mar-20 10:54am    
Yes, it's the same concept as master pages.

1 solution

It is not so much ASP.Net Classic vs MVC, as it actually is based on the View Engine- you are used to the WebForms engine and newer development uses the Razor engine. Early versions of MVC in Visual Studio (circa 2010) all used a MasterPage.

Anyways, you are on the right track.

References:
Layout in ASP.NET Core | Microsoft Docs[^]
Razor Pages Files | Learn Razor Pages[^]
The Razor _Layout.cshtml file | Learn Razor Pages[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900