Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

CSV Download
Hi All,

I have created a script which connects to a SQL DB, runs a query, writes the
results out to a file (Using FSO) then presents the user with a link to
download the CSV.
As the file contains sensitive data, I dont want to leave the file on the
server, and I dont want to rely on the user to delete the file after every
export.

Does anyone have any suggestions?

Thanks,
Simon.




Report this thread to moderator Post Follow-up to this message
Old Post
Simon Harris
10-27-04 01:55 AM


Re: CSV Download
Why not stream the contents of the file, instead of creating a file and
letting the user download it? So, instead of writing using FSO, you write it
out to the response object. Just make sure you change the content type to
reflect the CSV download:

<%
Response.ContentType = "text/csv"
%>

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com


"Simon Harris" <too-much-spam@makes-you-fat.com> wrote in message
news:OwlT$b6uEHA.3624@TK2MSFTNGP09.phx.gbl...
> Hi All,
>
> I have created a script which connects to a SQL DB, runs a query, writes
the
> results out to a file (Using FSO) then presents the user with a link to
> download the CSV.
> As the file contains sensitive data, I dont want to leave the file on the
> server, and I dont want to rely on the user to delete the file after every
> export.
>
> Does anyone have any suggestions?
>
> Thanks,
> Simon.
>
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Manohar Kamath
10-27-04 01:55 AM


Re: CSV Download
Yes, do not ever create the file!  :]

<%
set oADO = CreateObject("ADODB.Connection")
oADO.Open YourConnectionSTring

Set oRS = oADO.Execute("Your query")
sCSV = oRS.GetString(2,,",",vbCrLf,"")
oRS.Close : Set oRS = Nothing
oADO.Close : Set oADO = Nothing

Response.ContentType = "Simon's CSV File"
Response.AddHeader "Content-Disposition","attachment;
filename=sensitiveData.csv"
Response.Write sCSV
%>

Ray at work




"Simon Harris" <too-much-spam@makes-you-fat.com> wrote in message
news:OwlT$b6uEHA.3624@TK2MSFTNGP09.phx.gbl...
> Hi All,
>
> I have created a script which connects to a SQL DB, runs a query, writes
> the results out to a file (Using FSO) then presents the user with a link
> to download the CSV.
> As the file contains sensitive data, I dont want to leave the file on the
> server, and I dont want to rely on the user to delete the file after every
> export.
>
> Does anyone have any suggestions?
>
> Thanks,
> Simon.
>
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Ray Costanzo [MVP]
10-27-04 01:55 AM


Re: CSV Download
Thanks Manohar, sounds like a good idea - I guess I would create the CSV in
memory by building a string, then pump it all to the browser?

"Manohar Kamath" <mkamath@TAKETHISOUTkamath.com> wrote in message
news:%23Wjosn6uEHA.2616@TK2MSFTNGP10.phx.gbl...
> Why not stream the contents of the file, instead of creating a file and
> letting the user download it? So, instead of writing using FSO, you write
> it
> out to the response object. Just make sure you change the content type to
> reflect the CSV download:
>
> <%
>    Response.ContentType = "text/csv"
> %>
>
> --
> Manohar Kamath
> Editor, .netWire
> www.dotnetwire.com
>
>
> "Simon Harris" <too-much-spam@makes-you-fat.com> wrote in message
> news:OwlT$b6uEHA.3624@TK2MSFTNGP09.phx.gbl... 
> the 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Simon Harris
10-27-04 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

ASP archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:47 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.