我正在生成一个excel表,并希望用户自动下载它(询问他是否明显接受等),但我已经尝试了respond.writeFile()方法,但我得到的只是一个回发有趣的人物,有没有人能够帮助我并向我解释如何做到这一点?
这是我的代码:
Response.ContentType = "application/vnd.ms-excel"
Dim path As String = Server.MapPath("/uploads/monthly.xls")
Response.AppendHeader("Content-Disposition", "attachment; filename=" & path)
Dim contents As String = New System.Net.WebClient().DownloadString(path)
Response.Write(contents)
Response.End()