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. Send Binary File as response to webservice

Send Binary File as response to webservice

Scheduled Pinned Locked Moved ASP.NET
databasequestion
5 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.
  • B Offline
    B Offline
    BillyGoatGruff
    wrote on last edited by
    #1

    I am building a web survey type tool. There is a "reward download" for completing the questionnaire. The Questionnaire result / answers are submitted to a web service, to be stored in the db. What I would like to do, is once the db work is complete - to "send" the file to the client. The files are stored in DB BLOBs. I'd like to avoid writing them to disk (especially FTP-ing them somewhere and then redirecting the client to the file - that just seems messy...) I'd like to cause an http response whereby the user sees the browser's standard file download dialogue?

    E G 2 Replies Last reply
    0
    • B BillyGoatGruff

      I am building a web survey type tool. There is a "reward download" for completing the questionnaire. The Questionnaire result / answers are submitted to a web service, to be stored in the db. What I would like to do, is once the db work is complete - to "send" the file to the client. The files are stored in DB BLOBs. I'd like to avoid writing them to disk (especially FTP-ing them somewhere and then redirecting the client to the file - that just seems messy...) I'd like to cause an http response whereby the user sees the browser's standard file download dialogue?

      E Offline
      E Offline
      eggsovereasy
      wrote on last edited by
      #2

      I don't have a lot of experience with web services, but were this a plain old web form you would just have to get the blob from the database and store it in a database. Then use MemoryStream to stream it out to the client.

      B 1 Reply Last reply
      0
      • B BillyGoatGruff

        I am building a web survey type tool. There is a "reward download" for completing the questionnaire. The Questionnaire result / answers are submitted to a web service, to be stored in the db. What I would like to do, is once the db work is complete - to "send" the file to the client. The files are stored in DB BLOBs. I'd like to avoid writing them to disk (especially FTP-ing them somewhere and then redirecting the client to the file - that just seems messy...) I'd like to cause an http response whereby the user sees the browser's standard file download dialogue?

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        A call to a web service can not send a file directly to the client. To send a response to the client, you need to send a request from the client. Make a proxy page that gets the data from the database and writes it to the response stream. Make the browser request the page, and it will get the file in return.

        --- b { font-weight: normal; }

        B 1 Reply Last reply
        0
        • E eggsovereasy

          I don't have a lot of experience with web services, but were this a plain old web form you would just have to get the blob from the database and store it in a database. Then use MemoryStream to stream it out to the client.

          B Offline
          B Offline
          BillyGoatGruff
          wrote on last edited by
          #4

          Thanks for the idea, I gave it a whirl using an MP3 file with nonsense extension ".qwe" - IE just wrote the bytes' ASCII equivalents to the page... It seems to behave the same with Response.WriteFile and Response.TransmitFile If you could provide an example of where you've done this before that would be super. What I'm after is to get the browser to popup its normal... "What would you like to do with this file?... Download / Run?", dialogue.

          1 Reply Last reply
          0
          • G Guffa

            A call to a web service can not send a file directly to the client. To send a response to the client, you need to send a request from the client. Make a proxy page that gets the data from the database and writes it to the response stream. Make the browser request the page, and it will get the file in return.

            --- b { font-weight: normal; }

            B Offline
            B Offline
            BillyGoatGruff
            wrote on last edited by
            #5

            Ah-Ha !!! LightBulb ! You Guys ROCK!!! Many Thanks :-D

            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