I am connecting to my MS SQL server (2008) where I have stored JPG's as BLOB files and am retrieving them in a single page (displayImage.aspx) which I then show on other pages to display the image. This works great in all browsers on a Windows machine. However, from the OS X machines there is extended data being shown in the browser and the pictures are not displaying. (screenshot:http://i.imgur.com/133I8.png) Any suggestions? Code is below:
string image = Request.QueryString["image"];
if (image == null){
image = "no_image.jpg";
}
SqlConnection objConn = new SqlConnection(ConfigurationManager.ConnectionStrings["CONNECTIONSTRING"].ToString());
objConn.Open();
string sTSQL =
"SELECT [data] " +
"FROM [DBTABLE] " +
"WHERE filename = '" + image + "'";
SqlCommand objCmd = new SqlCommand(sTSQL, objConn);
objCmd.CommandType = CommandType.Text;
SqlDataReader dr = objCmd.ExecuteReader();
dr.Read();
Response.BinaryWrite((byte[])dr["data"]);
objConn.Close();