title: Setting a default src to img element
body: <p>Some people set default src to img element in the following way:</p>
  
  <pre><code>&lt;img src="foo.jpg" onerror="this.src='default.jpg'" /&gt;
  </code></pre>
  
  <p>I think it's not the best way because a additional http request will be sent when onerror event be fired, and our log component will log the worthless error message.</p>
  
  <p>I think I can do in following way:</p>
  
  <p>Create a HttpHandler(.ashx) to send appropriate image to client. So I can write a img in page like this: <code>&lt;img src=‘ImageHandler.ashx?id=foo.jpg’/&gt;</code>. App will check whether the image(<code>foo.jpg</code>) exists or not, then decides to send foo.jpg or default.jpg.</p>
  
  <p>Is it right? Do you have better resolution? </p>