我在MVC工作。我想在下载文件后刷新我的视图。
我尝试过以下代码:
Response.Clear()
Response.ClearHeaders()
Response.ClearContent()
Response.AddHeader("Content-Disposition", "attachment; filename=" + "MyFile.txt")
' Response.AddHeader("Target", "_self")
'Response.AddHeader("Content-Length", File.Length.ToString())
Response.ContentType = "text/plain"
Response.Flush()
Dim obytearray = UTF8Encoding.UTF8.GetBytes(pLicenseFile)
Dim ostring = UTF8Encoding.UTF8.GetString(obytearray)
Response.BinaryWrite(obytearray)
Response.[End]()
我想在客户端得到回复。或者是否可以在其他标签中下载并返回到我当前的视图?
我在以下行中尝试了内联:
Response.AddHeader("Content-Disposition", "Inline; filename=" + "MyFile.txt")
但在这种情况下,我失去了目前的观点:(
谢谢!