Layout cshtml not rendering after posting

I tested the application locally, which perfectly debugs my local computer. When I publish it on the server at work, _layout.cshtml does not render. They may not have any style at all, from the appearance of the developer tools. Any suggestions because I'm at a standstill and Google hasn’t found any such scripts for me? I am using MVC5 with Razor

My browsing begins

@{
     Layout = "~/Views/Shared/_Layout.cshtml";
 }

Edited version .... my _layout page

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - XXXXXXXXXXX</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    <meta name="Training Module" content="Website for oreintation and traing modules" />
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
    <img src="/Images/imgCClogoHorizontal.jpg" style="float: left; padding-top: 10px" />
    <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 style="padding-left: 30px">
                @Html.ActionLink("XXXXXXXXXXXX", "Index", "Module", null, new { @class = "navbar-brand" })
            </div>
        </div>
        <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                @*                                        <li>@Html.ActionLink("Home", "Index", "Home")</li>*@
                @*                                        <li>@Html.ActionLink("About", "About", "Home")</li>*@
                @*                                        <li>@Html.ActionLink("Orientation Videos", "Index", "Video")</li>*@
            </ul>
        </div>
    </div>
</div>


@Html.Action("Index", "NavigationMenu")
<div class="container body-content">
    <div style="display: inline">
        <div style="float: left">
            @RenderBody()
        </div>
        <h2>&nbsp;</h2>
    </div>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>

my bundle.config ...

public class BundleConfig
{
    // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
    public static void RegisterBundles(BundleCollection bundles)
    {

        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js",
                    "~/Scripts/jquery-ui-{version}.js"));

        // Use the development version of Modernizr to develop with and learn from. Then, when you're
        // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
        bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                    "~/Scripts/modernizr-*"));

        bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                  "~/Scripts/bootstrap.js",
                  "~/Scripts/respond.js"));

        bundles.Add(new StyleBundle("~/Content/css").Include(
          "~/Content/bootstrap.css",
          "~/Content/site.css",
          "~/Content/themes/base/jquery-ui.css"));
    }
}

}

+4
source share
3 answers

_ViewStart.cshtml , "", , . . SMH!!!!

+2

<head> <body>. , , , .

+2

Does your @ ViewBag.Title populate and you can see the title on the screen. If so, layout.cshtml is a render, but your css / js files might be missing. Can you check if you are linking all your resources correctly.

0
source

Source: https://habr.com/ru/post/1548676/


All Articles