1个回答
展开全部
HttpResponse..::.BinaryWrite 方法将一个二进制字符串写入 HTTP 输出流。
下面的示例将一个文本文件读入缓冲区,然后将该缓冲区写入 HTTP 输出流。
FileStream MyFileStream;
long FileSize;
MyFileStream = new FileStream("sometext.txt", FileMode.Open);
FileSize = MyFileStream.Length;
byte[] Buffer = new byte[(int)FileSize];
MyFileStream.Read(Buffer, 0, (int)FileSize);
MyFileStream.Close();
Response.Write("<b>File Contents: </b>");
Response.BinaryWrite(Buffer);
asp文件下载改名
Response.ContentType = "application/x-msexcel"
Response.AddHeader "Content-Disposition","attachment; filename=aa.xls"
Const adTypeBinary = 1
Dim strFilePath
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile Trim(sfile)
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
HttpResponse = true
下面的示例将一个文本文件读入缓冲区,然后将该缓冲区写入 HTTP 输出流。
FileStream MyFileStream;
long FileSize;
MyFileStream = new FileStream("sometext.txt", FileMode.Open);
FileSize = MyFileStream.Length;
byte[] Buffer = new byte[(int)FileSize];
MyFileStream.Read(Buffer, 0, (int)FileSize);
MyFileStream.Close();
Response.Write("<b>File Contents: </b>");
Response.BinaryWrite(Buffer);
asp文件下载改名
Response.ContentType = "application/x-msexcel"
Response.AddHeader "Content-Disposition","attachment; filename=aa.xls"
Const adTypeBinary = 1
Dim strFilePath
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile Trim(sfile)
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
HttpResponse = true
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询