1. OutputStream is the raw stream to output the content to the client side, you can customize your output by chaining other stream writersResponse.BinaryWrite, I believe, is for backward compatibility with ASP, it could be using this stream directly , but I have no idea, since I don't have access to the source code2. this content type is normally used when you don't want the browser to open a program registered for the specific content-type/file extension3. what I meant was, <asp:Button runat=server text="download" Onclick="DownloadFile" />runs in the context of current page, if you don't call Response.Clear()
Response.ClearHeaders()
...Response.End()in your DownloadFile method, some garbage content will also be written to the downloaded file, and it is also odd to embed the download logic inside the current page tooyou should be using something like
<a href="download.aspx?id=123">download</a>it is cleaner and more maintainable
for download huge amount of data, look intoStreaming Files Efficiently Using HTTPHandler and ISAPI
http://www.dotnetjunkies.com/Article/E9BE4431-3561-4A64-88C8-A49B2E50CBFA.dcik
Response.ClearHeaders()
...Response.End()in your DownloadFile method, some garbage content will also be written to the downloaded file, and it is also odd to embed the download logic inside the current page tooyou should be using something like
<a href="download.aspx?id=123">download</a>it is cleaner and more maintainable
for download huge amount of data, look intoStreaming Files Efficiently Using HTTPHandler and ISAPI
http://www.dotnetjunkies.com/Article/E9BE4431-3561-4A64-88C8-A49B2E50CBFA.dcik
整个页面为框架网页,分top和main,当下载文件后(下载页面在框架网页的mian页面),原先可用的top上的连接(链接到main)都不可用了,怎么回事??