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. Page not working properly after file disposition

Page not working properly after file disposition

Scheduled Pinned Locked Moved ASP.NET
helpdatabasesysadminwindows-adminxml
2 Posts 1 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.
  • M Offline
    M Offline
    milpo
    wrote on last edited by
    #1

    Hi, i am using a charting component to generate graphs for which data is dynamically gets bind from db In my page there is an image creation button is there, if a user clicks on that an image download dialogue will be displayed The code i am using for it is MemoryStream mstream = new MemoryStream(); try { Chart1.Save(mstream, ChartImageFormat.Png); byte[] byteArray = mstream.ToArray(); Response.AddHeader("Content-Disposition", "attachment; filename=report.png"); Response.AddHeader("Content-Length", byteArray.Length.ToString()); Response.ContentType = "image/png"; Response.BinaryWrite(byteArray); } catch { } finally { mstream.Flush(); mstream.Close(); } The image downloading works fine, but after image download if i rebind the report again from db the page is taking too long to load, some times page loads partially,some times page gives some xml error, which i will work fine if i dont click image generating button only binds the report. In my local system this works fine, but in staging server(IIS 6.0) it is giving the above problem

    M 1 Reply Last reply
    0
    • M milpo

      Hi, i am using a charting component to generate graphs for which data is dynamically gets bind from db In my page there is an image creation button is there, if a user clicks on that an image download dialogue will be displayed The code i am using for it is MemoryStream mstream = new MemoryStream(); try { Chart1.Save(mstream, ChartImageFormat.Png); byte[] byteArray = mstream.ToArray(); Response.AddHeader("Content-Disposition", "attachment; filename=report.png"); Response.AddHeader("Content-Length", byteArray.Length.ToString()); Response.ContentType = "image/png"; Response.BinaryWrite(byteArray); } catch { } finally { mstream.Flush(); mstream.Close(); } The image downloading works fine, but after image download if i rebind the report again from db the page is taking too long to load, some times page loads partially,some times page gives some xml error, which i will work fine if i dont click image generating button only binds the report. In my local system this works fine, but in staging server(IIS 6.0) it is giving the above problem

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

      Hi, now it is working fine, i just put Response.End() after Response.BinaryWrite(byteArray); and it is working,although i dont know the exact reason why

      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