检查浏览器控制台时,为什么我的应用程序在登录页面向我抛出一些 javascript 错误?
我已将 web.config 设置为包含以下内容:
<authentication mode="Forms">
<forms loginUrl="~/Login" timeout="90" />
</authentication>
然后我有一个_AnonymousUserLayout.cshtml
包含以下脚本:
<!-- Bootstrap JS -->
<script src="@Url.Content("~/Scripts/jquery-1.8.2.js")"></script>
<script src="@Url.Content("~/Scripts/bootstrap.js")"></script>
<!-- Supersized JS -->
<script src="@Url.Content("~/Scripts/supersized.core.3.2.1.js")"></script>
在我的Login.cshtml
(通过布局文件中的 RenderBody() 渲染)中,我包括以下内容:
<script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>
在我的Global.asax.cs
我定义了这个过滤器:
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new System.Web.Mvc.AuthorizeAttribute());
}
最后,我被重定向到我的登录页面_ViewStart.cshtml
:
@{
if (Request.IsAuthenticated)
{
Layout = "~/Views/Shared/_Layout.cshtml";
}
else
{
Layout = "~/Views/Shared/_AnonymousUserLayout.cshtml";
}
}
每当我没有登录并重定向到登录页面时,我都会在开发者控制台中看到以下错误:
Uncaught SyntaxError: Unexpected token < :54837/Login?ReturnUrl=%2FScripts%2Fkendo%2F2013.1.319%2Fjquery.min.js:1
Uncaught SyntaxError: Unexpected token < :54837/Login?ReturnUrl=%2FScripts%2Fkendo%2F2013.1.319%2Fkendo.all.min.js:1
Uncaught SyntaxError: Unexpected token < Login?ReturnUrl=%2FScripts%2Fkendo%2F2013.1.319%2Fkendo.aspnetmvc.min.js:1
我究竟做错了什么?