由于 asp.net c# 中的 URL 解析,部署时背景图像未显示

发布于 2024-09-29 08:45:47 字数 378 浏览 0 评论 0原文

我的 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜妞爱困 2024-10-06 08:45:47

尝试:

background: #fff url(/images/mainbg.jpg) repeat top left;

这取决于样式表相对于图像文件夹的位置。你应该能够得到它进行测试...

Try:

background: #fff url(/images/mainbg.jpg) repeat top left;

It depends where the style sheet is in relation to the images folder. You should be able to get it be testing...

北座城市 2024-10-06 08:45:47

好吧,我使用的是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文