Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problems with image rendering in IE6

Problems with image rendering in IE6

Scheduled Pinned Locked Moved ASP.NET
helpdatabasehtmlgraphicsperformance
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Daniel Petersen
    wrote on last edited by
    #1

    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: resource.aspx is handled by a custom HttpHandler for performance reasons, here is the code to it. 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

    M 1 Reply Last reply
    0
    • D Daniel Petersen

      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: resource.aspx is handled by a custom HttpHandler for performance reasons, here is the code to it. 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

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi Daniel, + I guess you mean the src attribute, not the source. + 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.

      D 1 Reply Last reply
      0
      • M minhpc_bk

        Hi Daniel, + I guess you mean the src attribute, not the source. + 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.

        D Offline
        D Offline
        Daniel Petersen
        wrote on last edited by
        #3

        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

        M 1 Reply Last reply
        0
        • D 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

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          Daniel, In your sample code, you might try using the ctx.Response.End(); method instead of the ctx.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);

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups