When the file is downloaded, the prompt box does not open directly.

zhaozj2021-02-16  99

// Read file output it

String strfile = "c: //abc.doc";

FILESTREAM FS = New FileStream (Strfile, FileMode.Open);

Byte [] bytes = new byte [(int) fs.length];

fs.read (bytes, 0, bytes.length);

fs.close ();

Response.contenttype = "Application / OcTet-stream";

Response.addheader ("Content-Disposition", "Attachment; FileName =" httputility.urlencode (file.name);

Response.binarywrite (bytes);

Response.end ();

转载请注明原文地址:https://www.9cbs.com/read-11207.html

New Post(0)