3

I'm using the ASP.NET bundling feature and want to know how I can get the URL returned by the Render helpers such as Scripts.Render("~/bundles/scripts").

Currently the optimized output is has a relative URL. I want to use a CDN that does origin-caching, so the final URL needs to be something like http://static.mydomain.com/bundles/scripts?v=XXXXXX

My plan is to simply write my own helper method, but I can't figure out how to get the version number relative URL for a given bundle.

Brian Vallelunga
  • 9,869
  • 15
  • 60
  • 87

1 Answers1

4

The solution was rather simple. There is a static method Scripts.Url and Styles.Url that give me exactly what I want. I was able to incorporate this into my own helper to concatenate the CDN's base URL.

Brian Vallelunga
  • 9,869
  • 15
  • 60
  • 87