這聽起來像你正在創建一個基本代理。你需要做的就像Tridus說的那樣,得到響應流,然後將內容從一個寫到另一個。我之前在一個可以幫助你的開源項目中完成了這項工作。
Managed Fusion Rewriter Proxy Class
我知道這是C#,但過程還是在VB一樣。而應該是這個樣子:
Using responseStream = response.GetResponseStream()
Using bufferStream = New BufferedStream(responseStream, Manager.Configuration.Rewriter.Proxy.BufferSize)
Dim buffer As Byte() = New Byte(bufferSize - 1) {}
Try
While True
' make sure that the stream can be read from
If Not bufferStream.CanRead Then
Exit While
End If
Dim bytesReturned As Integer = bufferStream.Read(buffer, 0, bufferSize)
' if not bytes were returned the end of the stream has been reached
' and the loop should exit
If bytesReturned = 0 Then
Exit While
End If
' write bytes to the response
context.Response.OutputStream.Write(buffer, 0, bytesReturned)
End While
Catch exc As Exception
Manager.Log("Error on response: " + exc.Message, "Proxy")
End Try
End Using
End Using
請注意,這是從我的源直接翻譯,所以你將不得不進行自定義你自己的計劃。