473,769 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Display the Save as dialog before ...

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("cont ent-disposition", "attachment ;
filename=""" & mZipFileName & """")

responseObject. BinaryWrite(mys trm.ToArray)
responseObject. Flush()

BuildZipStream( mystrm) ' Routine for performing the reports and
zipping them up
responseObject. BinaryWrite(mys trm.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
1 1452
no. its you content type on the save that triggers the dialog box. you can
flush eariler.

-- bruce (sqlwork.com)
"M Pearson" <ma**********@t echop.co.uk> wrote in message
news:99******** *************** ***@posting.goo gle.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("cont ent-disposition", "attachment ;
| filename=""" & mZipFileName & """")
|
| responseObject. BinaryWrite(mys trm.ToArray)
| responseObject. Flush()
|
| BuildZipStream( mystrm) ' Routine for performing the reports and
| zipping them up
| responseObject. BinaryWrite(mys trm.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
13487
by: Kannan | last post by:
Hello, I have a requirement that specifies that I display a "Please Wait..." window (preferably modal) along with a gif that mimics a progress bar during a save operation. The dialog needs to be closed at the end of the operation. How do I go about this... Issues are: 1. I believe a showModaldialog would stop all back ground processing and shift control to the modal dialog. 2. I would like to close the dialog from the parent window...
2
2369
by: Alvo von Cossel I | last post by:
hi, i have a textbox in a form. when you press a Save button, a savefiledialog appears. creating ther file works but everytime you click save, the dialog appears. how do i make the dialog appear once and then only save the file? thanx -- Alvo von Cossel I of Germany
4
5108
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download" Hyperlink1.NavigateUrl = "MyReport.csv" When the user clicks the HyperLink I would always like to
1
1880
by: Chan | last post by:
Hi I want to display save dialog box and display that file name in a text box All I want to do is, On click of a button, display save dialog box and display that file name in a text box Later this file name would be used to store some data response.addheader approach does not work in this situation because my requirement is quiet different Thank Chan
0
2979
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they entered. When this button is pressed and extract is prduced and IE's standard Open/Save dialog should popup so they can navigate to the directory to save the extract in, or if they want, they can choose to open and view the extract without saving it. ...
3
6440
by: =?Utf-8?B?YXNkZg==?= | last post by:
Hello. I am making a web application with c# and am using this code: Response.ContentType = "application/x-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("あいうえお") + ".csv"); Encoding encoding = Encoding.GetEncoding("Shift-JIS"); Response.BinaryWrite(encoding.GetBytes(csvStr)); Response.End(); It works fine..the data gets saved nicely to an excel file. The user pushes the...
2
10995
by: vbaDev | last post by:
Hi. I am using Access 2000 and in my code I'm exporting a table into an Excel file (creating it), then the code needs to export another query into the same file (a new worksheet). So I needed both a "Save As" dialog and the ability to grab the filepath so that the second export appends to it. Anyway, I found Microsofts method and it works, except that I can't figure out how to populate the File Name box in the Dialog with a default name (say,...
8
21866
by: paquer | last post by:
I'd like to provide an Export Function from my forms, where the User can choose the File name & save location Although I cannot get the "Save As" dialog box to open properly from access. What is the proper code to get Access to open the Windows Save As dialog box? Thanks
0
3752
by: ppardi | last post by:
I'm developing an addin for Word 2007 and I need to determine whether a user saves a Word 2007 document in an older format (97-2003) after a save as is done. The scenario is that the user starts out with a Word 2007 document, saves that document to disk, then saves the same document in an older format If the user saves a doc in an older format, I want to turn off certain features of my add-in. I'm able to trap the save event easily...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9416
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9849
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8861
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7393
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5433
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.