By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,313 Members | 1,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,313 IT Pros & Developers. It's quick & easy.

How to Display the Save as dialog before ...

P: n/a
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.
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
no. its you content type on the save that triggers the dialog box. you can
flush eariler.

-- bruce (sqlwork.com)
"M Pearson" <ma**********@techop.co.uk> wrote in message
news:99**************************@posting.google.c om...
| 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.
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.