0

似乎 ViewBag.Title & @RenderSection(..) 执行了多次,但我不知道为什么会发生

这是一个新项目,我刚刚实现了一个带有 Index.cshtml 包含的单个视图的控制器

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

和布局:

在此处输入图像描述

提前致谢 :)

4

1 回答 1

1

Buried beneath your screenshot I can perceive the root of your problem:

<a href="@Html.Action("Inde........
    <img src="~/Content/ima....
</a>

You wanted to use Url.Action and not Html.Action which is something entirely different.

<a href="@Url.Action("Inde........
    <img src="~/Content/ima....
</a>
于 2012-07-27T10:26:08.097 回答