【发布时间】:2011-08-06 08:02:05
【问题描述】:
我正在使用以下代码来允许用户下载文件。
Dim myFile As FileInfo = New FileInfo(strPath & strFile)
Response.AddHeader("Content-Disposition", "attachment; filename=" & _
Replace(myFile.Name, ".resources", ""))
Response.AddHeader("Content-Length", myFile.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.WriteFile(myFile.FullName)
这个方法有个烦人的问题,就是这行之后的代码都不能正确执行。
这是相当古老的代码,所以我猜现在可能有更好的方法来做到这一点。谁能推荐一个?
【问题讨论】:
-
确保你清理了你的回复。
-
为什么我被标记在这里。对我来说,这似乎是一个表达得非常清楚和公平的问题。