简体   繁体   English

vb.net CDN图像仅在生产中

[英]vb.net CDN Images Only on Production

Whats the right way to change the url for all the images on my site to use a cdn url or not based on a web.config value. 什么是正确的方法来更改我网站上所有图像的URL以使用cdn url还是不基于web.config值。

I have this web.config value 我有这个web.config值

<add key="UseCDN" value="1"/>

now my page has a whole bunch of <\\asp:image imageurl="RELATIVEPATH" tags. 现在我的页面上有一堆<\\ asp:image imageurl =“ RELATIVEPATH”标签。

I want them to point to my machine when "useCDN" = 0 and to cdn.com\\RELATIVEPATH when "useCDN" = 1 我希望他们在“ useCDN” = 0时指向我的机器,在“ useCDN” = 1时指向cdn.com \\ RELATIVEPATH

whats the best way to do this? 最好的方法是什么?

For you to implement a cross cutting solution, you have to extend the image control class and override the Render method to use the use the CDN value (if in production). 为了实现交叉切割解决方案,您必须扩展图像控件类并重写Render方法以使用CDN值(如果在生产中)。

Or just create a normal ASCX user control and use it. 或者只是创建一个普通的ASCX用户控件并使用它。 Can't search now but a simple search will get you plenty of tutorials. 现在无法搜索,但是简单的搜索即可为您提供大量的教程。

UPDATE: 更新:

A tutorial to help you do it 可以帮助您做到这一点的教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM