由于 asp.net c# 中的 URL 解析,部署时背景图像未显示
我的 .Net 应用程序中有两个主题,它们都使用相同的背景图像。两者都有一个图像文件夹,其中包含此图像,两者都有样式表。一种有效,一种无效,但仅当部署在虚拟目录场景中的 IIS 中时,因此会添加一个 /MyApp/ 目录。
我似乎无法欺骗那些无法找到图像的人。我的风格如下:
body
{
margin:0px;
font-family: Trebuchet MS, Verdana;
font-size: 12px;
font-style: normal;
background: #fff url(images/mainbg.jpg) repeat top left;
}
部署应用程序后解决图像目录的任何想法?
I have two themes in my .Net application, both use the same background image. Both have an images folder with this image in them, both have style sheets. One works and one doesn't but ONLY when deployed in IIS in a Virtual Directory scenario so there is an added /MyApp/ directory.
I can't seem to even trick the one that doesn't work into finding the image. My style looks like this:
body
{
margin:0px;
font-family: Trebuchet MS, Verdana;
font-size: 12px;
font-style: normal;
background: #fff url(images/mainbg.jpg) repeat top left;
}
Any ideas for resolving the images directory once the application is deployed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试:
这取决于样式表相对于图像文件夹的位置。你应该能够得到它进行测试...
Try:
It depends where the style sheet is in relation to the images folder. You should be able to get it be testing...
好吧,我使用的是 app_themes 文件夹,我的样式表位于根目录,我的图像位于主题目录的图像文件夹中。正如我所说,它在一种情况下有效,但在另一种情况下无效。每个中的代码与背景图像相同。我最终放弃了,并将样式表分解到一个完全独立的目录中,并将图像放入我的图像文件夹中,而不是我的主题中的图像文件夹中,并且它起作用了。对我来说,本质上相同的代码和目录结构呈现不同的结果是没有逻辑意义的。
Well I was using the app_themes folder and my stylesheet was at the root and my images were in the images folder of my themed directory. As I said it worked in once scenario but not the other. The code in each was identical as were the background images. I finally gave up and broke the stylesheet into a completely separate directory and put the image in my images folder instead of the images folder within my theme and it worked. It just makes no logical sense to me that code and directory structures that are essentially identical render different results.