Display CSV file in browser

M

Mei Qin

Hello,

I created a csv file on the server. I want to display it
in the browser and user can download the file to local
machine. Then I will delete the file from the server.
Here is my code:
Fname = "myfile.csv"
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("Content-
Disposition", "inline; filename=""" & Fname & """")
Response.WriteFile(Fname)

Response.Flush()
Response.Close()

System.IO.File.Delete(Fname)

When I open the file on the server, it displays fine. But
on the browser, all the commas remains and the whole
string goes to the first column. When I tried to save it
into a csv file to the local machine, all the string still
display in the first column.

I searched the this website. It seems lots of message are
about display csv file in browser. Does anybody encounter
the same problem as I do? What is the solution?

Please help!!!
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top