I am working with an asp.net mvc 4 application. I would like to set up my sites images to be rendered via a cdn.
Is there any mechanism within MVC to set up image paths resolving to a cdn? I want the cdn to be dynamic so I can configure it via app settings.
I have a couple ideas open to me
- Use a Html Helper to resolve all images with a cdn. Only issue with this is that I use spring.net dependency injection and dont believe its straight forward to inject in to a static class
- Create a attribute that I place on my controller that examines the html output from my views, use a regex to find all non resolved domains and resolve them. Concerned about performance on this
- Create an action result that is returned from my view that does similar to my previous point.
Any ideas/tips on this?