Is there a good website for public domain images?

Deploying website with cookie-free domain path update for images and other resources

  • I'm working on as asp.net application. The application is reasonably large and involves lot of pages with many reference images and scripts. I have hosted such content on a cookie-free sub-domain. My problem is - I have to manually update the path for all images and scripts upon deployment, by making them absolute-references to cookie-free domain content from relative-references of actual domain. How do I automate this ? Has anybody done this ? StackOverflow also uses cookie-free domain for various images on the site. Here's example upvote image which loaded from http://sstatic.net/so/img/vote-arrow-up.png

  • Answer:

    I solved a similar problem with custom controls (Images, etc.). Some I derived from existing controls (Image) some I created new. Within these Controls you could decide if you are in your dev environment or in production and render/change your links. EDIT: Add some example code. Note! This code is for demonstration purpose only! It's not perfekt! public class ExternalImage : System.Web.UI.WebControls.Image { protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (System.Configuration.ConfigurationManager.AppSettings["IsDev"] != "true") { this.ImageUrl = System.Configuration.ConfigurationManager.AppSettings["CookieFreeDomain"] + this.ImageUrl; } } }

this. __curious_geek at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

You can use tag transforms or control adapters. In case it helps, I cover both approaches in my book, along with code examples: http://rads.stackoverflow.com/amzn/click/1430223839

RickNZ

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.