Defining External Url for Url.Content()
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.
精彩评论