解决 url/url.content 在 IIS6.0 托管后无法获取 css 和脚本的正确路径
我已在 IIS 6.0 上托管了我的应用程序,我想要浏览的视图正在浏览器中获取,但 css 和脚本未呈现。
<link href="<%= Url.Content("~/Content/Tree.css")%>" rel="stylesheet" type="text/css" />
这样我就给出了路径。
i have hosted my application on IIS 6.0 the view that i wanted to browse is getting fetched in the browser but the css and scripts are not being rendered .
<link href="<%= Url.Content("~/Content/Tree.css")%>" rel="stylesheet" type="text/css" />
in this way i have given the path.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
link
标记已正确定义。您正在使用带有站点根目录的相对路径的Url.Content
方法,该方法将正确考虑在 IIS 下托管时可以添加的虚拟目录。我建议您查看 FireBug 来了解为什么找不到路径以及当 CSS 为空时服务器会发送什么响应取来的。文件丢失了吗?或者是否返回了其他状态代码?
The
link
tag is properly defined. You are using theUrl.Content
method with a relative path from the site root which will correctly take into account the virtual directory which could be added when hosting under IIS.I would recommend you looking at FireBug to see why the path is not found and what response does the server send when the CSS is fetched. Is the file missing? Or is there some other status code returned?