Area 文件夹中的样式、脚本和图像
我已经在 MVC 3 应用程序中设置了一个管理区域,虽然当我引用根脚本、样式和图像文件夹中的文件时一切正常,但当我在 /Areas/admin/< 下创建这些文件夹时它不起作用/code> 并像这样引用它们:
@Script.Include("~/admin/Scripts/superfish-1.4.8/js/superfish.js")
请注意,这个 Script.Include
帮助程序是我所拥有的,本质上是这样的:
<script type="text/javascript" src="/admin/Scripts/superfish-1.4.8/js/superfish.js"></script>
所以当我像这样引用时,帮助程序正在工作,一切都很好,
@Script.Include("~/Scripts/superfish-1.4.8/js/superfish.js")
但是不是当我介绍这个地区的时候名字在里面。这会导致 404 错误。
I've setup an Admin area within MVC 3 application and while everything is working when I reference files from the root Scripts, Styles and Images folder, it doesn't work when I created those folders under /Areas/admin/
and referenced them like this:
@Script.Include("~/admin/Scripts/superfish-1.4.8/js/superfish.js")
Please note that this Script.Include
helper is something that I have that essentially spits out this:
<script type="text/javascript" src="/admin/Scripts/superfish-1.4.8/js/superfish.js"></script>
So the helper is working and everything is fine when I reference like this
@Script.Include("~/Scripts/superfish-1.4.8/js/superfish.js")
but not when I introduce the area name in there. It results in a 404 Error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为脚本的实际路径如下:
应该呈现:
请注意我添加的
Areas
前缀。That's because the actual path to your script is the following:
which should render:
Notice the
Areas
prefix that I added.