locked
Trouble creating a download handler RRS feed

  • Question

  • User-762247171 posted

    Hi everyone.

    I have a download handler which gets an ID and retrieves a file from database. The following information is returned from database:

    data(binary data) name(file name) mime type

    It writes "data" to output stream and sets mime type. But when browser wants to download the file, it calls the file "DownloadHandler.axd" which is the name of handler.

    What do I have to do to send correct file name("name")?

    Thanks for your help,
    Farshid
     

    Friday, December 1, 2006 4:04 AM

All replies

  • User1347187933 posted

     

    I'm wondering if the ContentType set correctly by your HttpHandler.

    Usually client will determine the file name by its URL too.

    Wednesday, December 6, 2006 12:42 AM
  • User-762247171 posted

    Hello

    ContentType header is correct. I think I have found the solution, but not sure.
    I append a CONTENT-DISPOSITION header with this value: "attachment; filename=" + filename. This works for FireFox, but in IE, I get an error.

     

    Wednesday, December 6, 2006 6:55 AM
  • User1347187933 posted
    There are " around the filename, don't forget to add them. here is one example for .csv file.
    Content-type: application/octet-stream'
    Content-Disposition: attachment; filename="report.csv"
    Thursday, December 21, 2006 1:29 AM