在我的mvc应用程序中,我将css和js等资源设置如下
<link rel="stylesheet"
href="@Url.Content( "~/css/external/jquery-ui-1.8.16.custom.css" )"/>
<!-- PLUGIN: jQuery UI styling -->
<link href="@Href( "~/Content/uploadify.css" )" rel="stylesheet" />
<!-- File uploader -->在我的_Layout.cshtml
它在我的开发环境中工作,它决定
/css/external/jquery-ui-1.8.16.custom.css和
/Content/uploadify.css然后在IIS7下设置应用程序,并将别名设置为CommEditor
当我浏览它时,所有的资源都丢失了。
它正在看着
/CommEditor/css/external/jquery-ui-1.8.16.custom.css 和
/CommEditor/Content/uploadify.css我应该如何设置资源,使其同时适用于开发和IIS7?
发布于 2013-08-03 04:03:10
对于别名,请尝试在IIS7中设置应用程序的路径。试试这个:http://www.codeproject.com/Questions/460354/How-to-set-virtual-path-of-my-application-hosted-o
您应该能够在较新版本的mvc中使用~/folder/resource.ext语法。~根据应用程序的位置使用相对路径。
或者,如果Url.Content("~/folder/resource.ext")不起作用,则使用它,它应该在所有版本中都有效。
https://stackoverflow.com/questions/18025144
复制相似问题