我点击了一个按钮,它将从路径下载一些数据。我试图使这个按钮调用事件异步。
在按钮单击事件下,我正在调用异步方法 公共委托函数delAsyncMethodCaller()
**ButtonClick Method**
Dim obj As New delAsyncMethodCaller(AddressOf downloadReport)
Dim iAr As IAsyncResult = obj.BeginInvoke(New AsyncCallback(AddressOf AsyncComplete), Nothing)
Public Function downloadReport()
------Some Operation--------
strFileName = "Test"
Response.Clear()
Response.ClearHeaders()
Response.ClearContent()
Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileName)
Response.ContentType = "application/vnd.ms-excel.sheet.macroEnabled.12"
Response.BinaryWrite(exHelper.DownloadDocument(strDestinationPath & strFileName))
Response.End()
End Function
与asynchrounous调用一样,Response属性返回null。如何在不使用响应属性的情况下下载文件。