Search code examples
asp.netazurewebformscdnazure-cdn

How to use Windows Azure CDN with existing ASP.NET webforms application?


I have an ASP.NET Web Application on Azure and want to move my static content - images, CSS to the Azure CDN.

I have over 100 image files being used throughout the application stored in a folder "App_Themes/img" ...

In what way, can I minimize the effort in the move?

My current steps would be ... - Manually upload all files to cdn .. - Manually change all urls to the cdn (using Ctrl-H, but still is time-intensive and not error free) - Somehow manage the testing locally... (Add some code at every page to use a baseurl, depending on debug or release) ...

Is there any way that I could add a new route, etc so that I don't have to manually change the urls, as well as move between file-system urls and CDN to develop the application locally and deploy it.

Thanks a lot ..


Solution

  • What I did was added a config entry in the web.config:

    and replaced path /App_Themes/SpringDoctor/images/ with <%=System.Configuration.ConfigurationManager.AppSettings["ImagesPath"]%>

    And upload all images to the appropriate blob.