I have the following code where 'result.resultstream' is a valid reponse from a web request.
I am attempting the to first check for a particular piece of text in the stream and if found then continue on to parse the stream elsewhere within my application(using sax parser). The problem I am having is that when performing the 1st check by converting the stream to text, this appears to auto close the stream? the second operation then fails with a "attempt to read a closed stream" error message (shown in red). Is there anyway to read utilise the stream more than once?
Dim t As TextReader
t.Initialize(result.ResultStream)
' have we any image in the response?
If t.ReadAll.IndexOf("GetProductImageFullSizeResult") = -1 Then
ToastMessageShow("There is no image available for this item.",True)
Return
End If
xmlParser.Initialize()
xmlParser.Parse(result.ResultStream,"GetProducIImageFullSize")