Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

How to trigger a download of a file

I have a ISAPI program which retrieves data from a database and writes the data into a file with Comma Separated Value format. When the user triggers the execution of this ISAPI Dll, I want the user to get the file download dialog. What do I need to send instead of the existing code:

      StrPCopy(vBuffer, 'Content-Type: text/html' + CrLf +  CrLf +
                   '<HTML>' + CrLf + '<HEAD>' + CrLF + '<TITLE>Report</TITLE>' + CrLf +
                   '</HEAD>' + CrLf + '<BODY BGCOLOR="#FFFFFF" TEXT="#000000" BACKGROUND="yellowbk.gif"><DIV ALIGN="CENTER"><CENTER>' + CrLf + CrLf );

I suspect I need to change the Content-Type, etc...

Thank you
0
moonrise
Asked:
moonrise
  • 3
  • 2
1 Solution
 
TintinCommented:
Content-Type: application/vnd.ms-excel

or

Content-Type: application/octet-stream
0
 
moonriseAuthor Commented:
Content-Type: application/octet-stream  works - how do I specify the default file name to be used, let say report.csv?
0
 
TintinCommented:
Content-Type: application/octet-stream; name=report.csv
0
 
moonriseAuthor Commented:
instead of using the file name I specify it uses the name of the DLL (ISAPI) - report.dll, any idea why?
0
 
TintinCommented:
Hmmm.  Got me stumped there.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now