开发者

Defining External Url for Url.Content()

开发者 https://www.devze.com 2023-02-02 04:14 出处:网络
Is there any way to alter the behavior of Url.Content rendering mechanism so that my static content in the page is loaded from an external server?

Is there any way to alter the behavior of Url.Content rendering mechanism so that my static content in the page is loaded from an external server?

To explain further, suppose you have an ASP.NET MVC 2 website, http://www.example.com and at some point, your want your static content to be loaded from static.example.com . But you have coded your application with syntax like Url.Content("~/Content/images/a.gif"). From that po开发者_Python百科int, is there some configuration change within the ASP.NET MVC to render these URL's as "http://static.example.com/Content/images/a.gif"?

Thanks in advance.


Unforunately there is no such configuration setting. Your best approach would be to write your own helper extension method hanging off of UrlHelper that you control.

0

精彩评论

暂无评论...
验证码 换一张
取 消