How to Display the Save as dialog before ...

  • Thread starter Thread starter M Pearson
  • Start date Start date
M

M Pearson

Hello there all, am very new to asp.net programming and am struggling
with this problem.

What I trying to achieve.
On a button click I want the standard web save as dialog to display.
The user specifies where to save.
I then generate the file which is a series of reports zipped up, which
then gets saved to the users pc.

The following is some sample code:
responseObject.ClearContent()
responseObject.ClearHeaders()
responseObject.ContentType = contentType

responseObject.AddHeader("content-disposition", "attachment;
filename=""" & mZipFileName & """")

responseObject.BinaryWrite(mystrm.ToArray)
responseObject.Flush()

BuildZipStream(mystrm) ' Routine for performing the reports and
zipping them up
responseObject.BinaryWrite(mystrm.ToArray)

The problem with this code the save as dialog always opens after I
have finished building up my zip file.


Is it possible to get the Save As dialog to display before I have a
file available and then start streaming the file. I am trying to avoid
instances where the web pages sits there waiting for the save dialog
to be displayed while the zip file is created.
Any help or suggestions would be appreciated.
 
no. its you content type on the save that triggers the dialog box. you can
flush eariler.

-- bruce (sqlwork.com)


| Hello there all, am very new to asp.net programming and am struggling
| with this problem.
|
| What I trying to achieve.
| On a button click I want the standard web save as dialog to display.
| The user specifies where to save.
| I then generate the file which is a series of reports zipped up, which
| then gets saved to the users pc.
|
| The following is some sample code:
| responseObject.ClearContent()
| responseObject.ClearHeaders()
| responseObject.ContentType = contentType
|
| responseObject.AddHeader("content-disposition", "attachment;
| filename=""" & mZipFileName & """")
|
| responseObject.BinaryWrite(mystrm.ToArray)
| responseObject.Flush()
|
| BuildZipStream(mystrm) ' Routine for performing the reports and
| zipping them up
| responseObject.BinaryWrite(mystrm.ToArray)
|
| The problem with this code the save as dialog always opens after I
| have finished building up my zip file.
|
|
| Is it possible to get the Save As dialog to display before I have a
| file available and then start streaming the file. I am trying to avoid
| instances where the web pages sits there waiting for the save dialog
| to be displayed while the zip file is created.
| Any help or suggestions would be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top