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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. sending file to client side

sending file to client side

Scheduled Pinned Locked Moved ASP.NET
sysadminquestion
4 Posts 3 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.
  • R Offline
    R Offline
    rak
    wrote on last edited by
    #1

    Hi, I need to send a file created at the server to client side. I could redirect the url to point to the excel file im generating and rely on IE to open. But I want the open/save dialog to popup. Is there any way I can stream the file? thanks Rak

    N 1 Reply Last reply
    0
    • R rak

      Hi, I need to send a file created at the server to client side. I could redirect the url to point to the excel file im generating and rely on IE to open. But I want the open/save dialog to popup. Is there any way I can stream the file? thanks Rak

      N Offline
      N Offline
      Norman Fung
      wrote on last edited by
      #2

      The REFERENCE article below is not exactly what you're asking for, but if you look at it carefully, it gives you what it takes to send a file to client side: By playing with Http headers: Response.AppendHeader("Content-Disposition","attachment; filename=" + fileName); Response.ContentType = contentType; Response.OutputStream.Write(fileData, 0, fileData.Length); //fileData is held in memory --> you need to load the memory with your Excel file instead. REFERENCE: http://stardeveloper.com/articles/display.html?article=2003031201&page=11 One caveat: It's important to specify "content length". You will find corrupted files otherwise (An important piece of information not found in the article). But, here it is: Response.AppendHeader("Content-Length", filesize.ToString()); norm

      R 1 Reply Last reply
      0
      • N Norman Fung

        The REFERENCE article below is not exactly what you're asking for, but if you look at it carefully, it gives you what it takes to send a file to client side: By playing with Http headers: Response.AppendHeader("Content-Disposition","attachment; filename=" + fileName); Response.ContentType = contentType; Response.OutputStream.Write(fileData, 0, fileData.Length); //fileData is held in memory --> you need to load the memory with your Excel file instead. REFERENCE: http://stardeveloper.com/articles/display.html?article=2003031201&page=11 One caveat: It's important to specify "content length". You will find corrupted files otherwise (An important piece of information not found in the article). But, here it is: Response.AppendHeader("Content-Length", filesize.ToString()); norm

        R Offline
        R Offline
        rak
        wrote on last edited by
        #3

        Thanks norman. that helped

        C 1 Reply Last reply
        0
        • R rak

          Thanks norman. that helped

          C Offline
          C Offline
          CillyMe
          wrote on last edited by
          #4

          Happy coding rak.

          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