我正在尝试创建一个可以下载和返回图像的代理图像加载器。我的代码非常接近,它正在显示图像,但是我相信某些字节并没有正确显示:
Dim myRequest As WebRequest = WebRequest.Create(URL)
Dim myResponse As WebResponse = myRequest.GetResponse()
Response.ContentType = "image/jpeg"
Response.Clear()
Response.BufferOutput = True
Dim strm As Stream = myResponse.GetResponseStream()
Dim buffer As Byte() = New Byte(4095) {}
Dim byteSeq As Integer = strm.Read(buffer, 0, 4096)
Do While byteSeq > 0
Response.OutputStream.Write(buffer, 0, 4096)
byteSeq = strm.Read(buffer, 0, 4096)
Response.Flush()
Loop
任何帮助是极大的赞赏。