我刚刚创建了一个新的ASP.Net MVC3项目,它不会从Scripts文件夹加载任何脚本,在我调试时给我404.
我如何解决这个问题?
包括这样:
<script type="text/javascript" src="../../Scripts/jquery.validationEngine.js"></script>
<script type="text/javascript" src="../../Scripts/languages/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src="../../Scripts/bootstrap-transition.js"></script>
<script type="text/javascript" src="../../Scripts/bootstrap-alert.js"></script>
<script type="text/javascript" src="../../Scripts/bootstrap-modal.js"></script>
或在App_Code中使用全局变量,如下所示:
public static readonly string JSDir = "../../Scripts";
在我看来:
<script type="text/javascript" src="@GlobalVal.JSDir/jquery.validationEngine.js"></script>
<script type="text/javascript" src="@GlobalVal.JSDir/languages/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src="@GlobalVal.JSDir/bootstrap-transition.js"></script>
<script type="text/javascript" src="@GlobalVal.JSDir/bootstrap-alert.js"></script>
<script type="text/javascript" src="@GlobalVal.JSDir/bootstrap-modal.js"></script>
也试过这个:
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validationEngine.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/languages/jquery.validationEngine-en.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/bootstrap-transition.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/bootstrap-alert.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/bootstrap-modal.js")"></script>
无论哪种方式,结果相同。 404用于Scripts文件夹中的所有文件。
答案 0 :(得分:0)
一个Web.config文件已被放置在该目录中,该目录具有阻止从该文件夹中提供任何内容的http处理程序。