473,406 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Another "Virtual File" question.

I followed the information in a previous thread, but i'm having
problems.

I have a couple dropdownlists and a submit button on my form. The user
selects choices from the lists and clicks the submit button. The app
then places the data requested into a string variable.

I want to send this data out to the client and have the save dialog
prompt him to save it as a file. Here's the code.

' Variable csvOut is a string that contains my data.
With Response
.ContentType = "text/csv"
.AddHeader("content-disposition", "attachment;
filename=NetopImport.txt")
.Write(csvOut)
End With

1. When the save dialog appears on the client, if I click "Save" then
it saves the file. I open the file to find my data at the top, but then
the page source follows that.

2. If I click "Open" on the save dialog, the save dialog appears a 2nd
time and I click open again. Notepad opens and I see my data followed by
the page source.

Any help is appreciated. Thanks!

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #1
3 1308
In other words, after the dropdown and submit button action, you want
the page to outputting your string and then stop processing, correct?
If so, I think you'll just need to add a .End() after your
..Write(csvOut). However, to be safe, I'd also clear the content of the
Response buffer as well. Here's the result:

' Begin code
' Variable csvOut is a string that contains my data.
With Response
.ClearContent()
.ContentType = "text/csv"
.AddHeader("content-dispositio*n",
"attachment;filename=NetopImport.txt")
.Write(csvOut)
.End()
End With

' End code

Does that do what you want?

Nov 19 '05 #2
Yup, the .End did the trick. I was just about to post that I'd figured
out that part of it. Thanks.

But now, why, when I click "Open" in the Save Dialog do I get presented
with another Save Dialog instead of the file opening in Notepad? Once I
click "Open" a second time, then Notepad opens up.
*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #3
Try a .ClearHeaders() in there right after .ClearContent()

See if that does it.

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: S. McKee | last post by:
Hi, I am very (very very) new to java and have what I am sure is a simple problem that I hope someone can help with. I have two .java files. The first has public final class FormatSWN { ...
1
by: Ian | last post by:
I have an application called "Test.exe" and this application has a config file called "Test.exe.config" and it holds the connection string for the database calls in there. To get the...
12
by: cppaddict | last post by:
Hi, I know that it is illegal in C++ to have a static pure virtual method, but it seems something like this would be useful when the following 2 conditions hold: 1. You know that every one...
21
by: siroregano | last post by:
Hi Everyone- I'm new to this group, and almost-as-new to asking programming questions publicly, so please forgive me if I miss a convention or two! I have a text file, around 40,000 lines...
175
by: Ken Brady | last post by:
I'm on a team building some class libraries to be used by many other projects. Some members of our team insist that "All public methods should be virtual" just in case "anything needs to be...
17
by: Eric_Dexter | last post by:
def simplecsdtoorc(filename): file = open(filename,"r") alllines = file.read_until("</CsInstruments>") pattern1 = re.compile("</") orcfilename = filename + "orc" for line in alllines: if not...
9
by: Sonnich | last post by:
Hi! I want to have a number of strings in another file, which I can include everywhere... but I cannot make them reachable from the top file. I have looked at var and global to to this but...
0
by: Peter Nofelt | last post by:
Hi all, ISSUE: ==================== In SQL 2005 (sp2) I get the following error when preforming a bulk insert with an associated xml format file: "Could not bulk insert. Unknown version of...
17
by: sagar | last post by:
Hi, I have a C file(add.c) in which i have a function called add.now i want to call the same add function from another file sub.c .Can any1 tell how to do that... Thanks in advance Mark
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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 project—planning, coding, testing,...
0
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...

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.