我可以在页面内容div中的剃刀页面顶部看到字符。我无法追踪并删除它。 任何人都可以帮我删除它吗?
答案 0 :(得分:0)
ISO-8859-1中UTF-8 BOM的Byte order mark。 尝试修改剃刀页面中的编码。
答案 1 :(得分:0)
我遇到了同样的问题,并且可以删除视图顶部的空行来删除这些符号。
示例:
[blank row here] --> remove this
@model RecLeagueBlog.Models.UserRoleViewModel
@{
ViewBag.Title = "EditUser";
Layout = "~/Views/Shared/_DashboardLayout.cshtml";
}
答案 2 :(得分:0)
使用以下代码调用静态html页面的简单方法。
public ActionResult Index()
{
var staticPageToRender = new FilePathResult("~/uploads/test.html", "text/html");
return staticPageToRender;
}
答案 3 :(得分:0)
正确答案来自: How do I make Razor read UTF-8 files without BOM?
只需将其添加到您的web.config
<system.web>
<globalization fileEncoding="utf-8" />
</system.web>
BOM符号现在不见了。