【发布时间】:2021-08-20 11:56:25
【问题描述】:
我需要将 Byte() 转换为流然后刷新 它在 asp.net 应用程序中
这是我的代码:
Dim fileBytes As Byte() = Nothing
....
apiProp.BodyRequest = New JavaScriptSerializer().Serialize(entFile)
apiProp.EndPoint = "example.com/DownloadFile"
apiProp = api.MessageInvoke(apiProp)
entResponse = JsonConvert.DeserializeObject(Of FileResponse)(apiProp.BodyResponse)
fileBytes = Convert.FromBase64String(entFile.fileContent)
我试过了:
Response.BinaryWrite(fileBytes)
Response.Flush()
我已经尝试过任何文件流、内存流等文件要求下载,但如果我下载文件,文件会损坏
我需要将文件转换为流,因为我必须在图像文件上添加水印。我使用 groupdocs.watermark 添加水印。
【问题讨论】:
-
这能回答你的问题吗? ASP.NET file download from server
-
否,因为我需要处理文件以添加水印,我使用 groupdocs.watermark 添加水印,库需要流/文件路径(字符串)参数,但我将文件保存在 base64我的服务器中的字符串。所以我无法获取文件路径(或者如果我的文件转换为 base64 字符串,我不明白如何获取文件路径)
标签: asp.net vb.net model-view-controller