使用 asp.net 2.0 从网页实现下载操作的最佳方法是什么?
操作的日志文件在名为 [Application Root]/Logs 的目录中创建。我有完整路径并想提供一个按钮,单击该按钮会将日志文件从 IIS 服务器下载到用户本地电脑。
这有帮助吗:
http://www.west-wind.com/weblog/posts/76293.aspx
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition","attachment; filename=logfile.txt");
Response.TransmitFile( Server.MapPath("~/logfile.txt") );
Response.End();
Response.TransmitFile 是发送大文件的可接受方式,而不是 Response.WriteFile。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)