You should use Response.End() in the sample above. Otherwise you'll get some garbage at the end of JPEG file (like [[[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html ><head><title>ASP.NET Example</title></head><body>]]] etc).