Response.WriteFile的应用~
1.可以读取文件,将文件在页面显示。
保存<table>
<tr>
<td style="width: 100px"><% Response.WriteFile("HTMLPage.htm"); %></td>
</tr>
</table>
2.读取文件做下载功能:
保存private void downloadfile(string fname)
{
if (fname == null || fname.trim() == "")
return;
fileinfo file = new fileinfo(fname);
response.clear();
response.addheader("content-disposition",
"attachment; filename=" + httputility.urlencode((file.name), system.text.encoding.utf8));
response.addheader("content-length", file.length.tostring());
response.contenttype = "application/octet-stream";
response.writefile(file.fullname);
response.flush();
response.close();
response.end();
}

浙公网安备 33010602011771号