Is there a way (perhaps IIS, web.config, or other) where I can set a default image for missing images on a website? I’d like to send a custom image in the case where the image you are trying to view doesn’t exist.
I’m using MVC3, and I know that I can create a custom Image controller action like in https://stackoverflow.com/a/5606575/435460. I’d like a more general solution though.
You could write an HTTPModule to intercept requests for common image extensions, test for the presence of the file, and if missing instead return a default image.
Find an overview for writing an HTTPModule here and here
You might also consider a look at this Codeplex project