Problems with image rendering in IE6
-
I have been having a problem with IE6 not rendering an image retrieved from a MS SQL 2000 database, however, Firefox will render the image just fine. I have tried ideas to fix this from a number of sources but nothing works. The HTML that retrieves the images looks like:
using System; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Web; using System.Web.Caching; namespace naulor { public class Resource : IHttpHandler { private string conn; public Resource() { conn = (String)System.Configuration.ConfigurationSettings.AppSettings.Get("sql_app"); } #region IHttpHandler Members public void ProcessRequest(HttpContext ctx) { if(ctx.Request.Params.HasKeys() == true) { Byte[] data = (Byte[])ctx.Cache[ctx.Request.Params[0].ToString()]; string mime = String.Empty; string title = String.Empty; string extension = String.Empty; if(data == null) { SqlDataReader reader = null; SqlConnection cnn = new SqlConnection(conn); SqlCommand cmd = new SqlCommand("GetResource",cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cmd.Parameters.Add("@ID",SqlDbType.BigInt); cmd.Parameters["@ID"].Value = Int64.Parse(ctx.Request.Params[0].ToString()); try { cnn.Open(); reader = cmd.ExecuteReader(); reader.Read(); title = reader[0].ToString(); mime = reader.GetString(1); extension = reader[2].ToString(); data = (Byte[])reader[3]; ctx.Cache.Insert(ctx.Request.Params[0].ToString(), data, null,DateTime.Now.AddSeconds(300),TimeSpan.Zero); } catch(Exception ex) { System.Web.Mail.MailMessage msg = new System.Web.Mail.MailMessage(); msg.From = (String)System.Configuration.ConfigurationSettings.AppSettings.Get("administrator"); msg.To = (String)System.Configuration.ConfigurationSettings.AppSettings.Get("developer"); msg.BodyFormat = System.Web.Mail.MailFormat.Html; msg.Subject = "NAU LOR Resource Error"; msg.Body = String.Format("An error occurred while performing**{0}** The error was: {1}",ex.Message,ex.ToString()); System.Web.Mail.SmtpMail.SmtpServer = (String)System.Configura
-
I have been having a problem with IE6 not rendering an image retrieved from a MS SQL 2000 database, however, Firefox will render the image just fine. I have tried ideas to fix this from a number of sources but nothing works. The HTML that retrieves the images looks like:
using System; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Web; using System.Web.Caching; namespace naulor { public class Resource : IHttpHandler { private string conn; public Resource() { conn = (String)System.Configuration.ConfigurationSettings.AppSettings.Get("sql_app"); } #region IHttpHandler Members public void ProcessRequest(HttpContext ctx) { if(ctx.Request.Params.HasKeys() == true) { Byte[] data = (Byte[])ctx.Cache[ctx.Request.Params[0].ToString()]; string mime = String.Empty; string title = String.Empty; string extension = String.Empty; if(data == null) { SqlDataReader reader = null; SqlConnection cnn = new SqlConnection(conn); SqlCommand cmd = new SqlCommand("GetResource",cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cmd.Parameters.Add("@ID",SqlDbType.BigInt); cmd.Parameters["@ID"].Value = Int64.Parse(ctx.Request.Params[0].ToString()); try { cnn.Open(); reader = cmd.ExecuteReader(); reader.Read(); title = reader[0].ToString(); mime = reader.GetString(1); extension = reader[2].ToString(); data = (Byte[])reader[3]; ctx.Cache.Insert(ctx.Request.Params[0].ToString(), data, null,DateTime.Now.AddSeconds(300),TimeSpan.Zero); } catch(Exception ex) { System.Web.Mail.MailMessage msg = new System.Web.Mail.MailMessage(); msg.From = (String)System.Configuration.ConfigurationSettings.AppSettings.Get("administrator"); msg.To = (String)System.Configuration.ConfigurationSettings.AppSettings.Get("developer"); msg.BodyFormat = System.Web.Mail.MailFormat.Html; msg.Subject = "NAU LOR Resource Error"; msg.Body = String.Format("An error occurred while performing**{0}** The error was: {1}",ex.Message,ex.ToString()); System.Web.Mail.SmtpMail.SmtpServer = (String)System.Configura
Hi Daniel, + I guess you mean the
src
attribute, not thesource
. + Have you tried launching the web page with IE6 from another machine? If it works, the problem can be with the IE browser itself on the testing machine and you can install all the patches for it. -
Hi Daniel, + I guess you mean the
src
attribute, not thesource
. + Have you tried launching the web page with IE6 from another machine? If it works, the problem can be with the IE browser itself on the testing machine and you can install all the patches for it.Yes I have tried launching the page from several different machines, all with the same results. IE will usually act like it is trying to download an image but is never able to complete it, yet Firefox will grab the images and displays them without any delay. Sorry about the typo I did mean src not source, thanks Daniel Petersen
-
Yes I have tried launching the page from several different machines, all with the same results. IE will usually act like it is trying to download an image but is never able to complete it, yet Firefox will grab the images and displays them without any delay. Sorry about the typo I did mean src not source, thanks Daniel Petersen
Daniel, In your sample code, you might try using the
ctx.Response.End();
method instead of thectx.Response.Close();
. Once you send the image data back to the client side, you should end the current request by aborting the current thread. Also, is it necessary to create an instance of the Image type? Since you can simply write out the binary data of the image to output stream of the Response object as below:ctx.Response.OutputStream.Write(data, 0, data.Length);