非常奇怪的问题,因为这在我们旧的 Classic ASP 站点上运行良好。我们基本上是在查询数据库并通过 Response.Write 将大约 2200 行文本导出到文本文件以输出到对话框并允许用户保存文件。
Response.Clear() Response.ClearContent() Response.ClearHeaders()
Dim fileName As String = "TECH" & test & ".txt"
Response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}", fileName))
Response.ContentType = "text/plain"
Response.Write(strHeader)
Dim sw As New IO.StringWriter()
Dim dtRow As DataRow
For Each dtRow In dt3.Rows
sw.Write(dtRow.Item("RECORD") & vbCrLf)
Next
Response.Write(sw.ToString)
Response.Write(strTrailer & intRecCount)
Response.End()
我可以使用 StringWriter 或简单地使用 Response.Write(dt.Rows(i).Item("RECORD").toString
无论哪种方式,Export 都会在我们的开发站点上造成可怕的挂起。我的本地机器不会导致挂起,几乎是瞬时的。记录集不是很大,它正在写入的行很小。
任何人都知道为什么这会被挂起?它最终允许保存和显示文件,但它远远超过 3-4 分钟。