1个回答
展开全部
<%@ Page Language="C#"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%
Response.Clear();
string path = @"F:\TDDOWNLOAD\Book\C#游戏编程入门.pdf";
Response.ContentType = "application/pdf";
Response.AddHeader("content-disponstion", "filename=C#游戏编程入门.pdf");
byte[] buffer = new byte[256];
FileStream fs = File.Open(path, FileMode.Open);
Response.AddHeader("content-length", fs.Length.ToString());
int length = (int)fs.Length;
if (Response.IsClientConnected)
{
while (length > -1)
{
length = length - buffer.Length;
fs.Read(buffer, 0, buffer.Length);
Response.OutputStream.Write(buffer, 0, buffer.Length);
}
}
fs.Close();
Response.End();
%>
是哦 这个就是显示到网页上的。
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%
Response.Clear();
string path = @"F:\TDDOWNLOAD\Book\C#游戏编程入门.pdf";
Response.ContentType = "application/pdf";
Response.AddHeader("content-disponstion", "filename=C#游戏编程入门.pdf");
byte[] buffer = new byte[256];
FileStream fs = File.Open(path, FileMode.Open);
Response.AddHeader("content-length", fs.Length.ToString());
int length = (int)fs.Length;
if (Response.IsClientConnected)
{
while (length > -1)
{
length = length - buffer.Length;
fs.Read(buffer, 0, buffer.Length);
Response.OutputStream.Write(buffer, 0, buffer.Length);
}
}
fs.Close();
Response.End();
%>
是哦 这个就是显示到网页上的。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询