downloading .xls files from the web

G

gella

Hi
I m new to ASP.net development.
I am making a proj tht involves downloading and saving excel sheets
from a URL like

http://www.puc-rio.br/marco.ind/xls/dp-chapter6-nonlinear_npv.xls

Can someone tell me how to do tht?

Thanx!
hi,
check using this..

-----------
Response.ContentType="application/ms-excel";
filepath=Server.MapPath("filepath");
Response.AddHeader( "content-disposition","attachment;
inline;filename='"filename"");
FileStream sourceFile = new FileStream(filepath, FileMode.Open);
long FileSize;
FileSize = sourceFile.Length;
byte[] getContent = new byte[(int)FileSize];
sourceFile.Read(getContent, 0, (int)sourceFile.Length);
sourceFile.Close();
Response.BinaryWrite(getContent);
Response.End();

regards,
gella
 
C

Chris Mahoney

Response.ContentType="application/ms-excel";

Shouldn't the type be "application/vnd.ms-excel"? There's no such
thing as "application/ms-excel" listed at IANA (http://www.iana.org/
assignments/media-types/). I'm a bit new to MIME types so correct me
if I'm wrong!

Chris
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top