ASP.NET主题和静态内容 [英] ASP.NET themes and static contents

查看:145
本文介绍了ASP.NET主题和静态内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

众所周知,ASP.NET在页面中的App_Themes的Theme文件夹中包含每个CSS样式表。没有讨论。



但现在,我面临一个小问题,在主题中有很多CSS文件,并愿意使用静态内容域。我想从静态域(不仅CSS,而且图标,图像等)加载我的网站的所有静态内容,但让我们现在只注意CSS。



我的问题是



是否可以覆盖页面类的行为, CSS文件中找到主题的文件夹,重写< link> 标签与静态内容域的正确的URL?我没有什么阻止我将文件部署到 http://static.domain.com/App_Themes/Theme

>解决方案

另一种方法是写一个http模块。让模块检查正在发送回客户端的html。



如果检测到样式表引用,请更改样式表从中拉出的位置。



适用于其他项目,如图片等。


as you all know, ASP.NET includes each CSS stylesheet in the App_Themes's Theme folder inside the page. No discussion.

But now, I'm facing a little problem having lots of CSS files in a theme and willing to use a static content domain. I would like to load all the static content of my website from the static domain (not only CSS, but also icons, images, etc.), but let's now pay attention only to CSS.

My question is

Is it possible to override the behaviour of Page class, and for each CSS file found in Theme's folder, rewrite the <link> tag with the correct URL of the static content domain? I have nothing preventing me to deploy files into http://static.domain.com/App_Themes/Theme path, so at least adding a prefix to the tag is fine.

Thank you in advance.

解决方案

An alternate method is to write an http module. Have the module inspect the html being sent back to the client.

If it detects a style sheet reference, change the location that the style sheet is pulling from.

This works for the other items as well, such as images etc.

这篇关于ASP.NET主题和静态内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆