I'm using this function to get the response of my requested URL. Not any error occurring with this function but the value it returns isn't what I want.
Here is the response from Firefox:
The function returns the HTML part but doesn't return the nextCursorEndpoint part. I want to get the nextCursorEndpoint part.
My code:
Private Function GET_Request(ByVal URL As String, ByVal CC As CookieContainer) As String
Try
Dim req As HttpWebRequest = DirectCast(WebRequest.Create(URL), HttpWebRequest)
With req
.Method = "GET"
.CookieContainer = CC
.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0"
End With
Using response As WebResponse = req.GetResponse()
Using resStream As Stream = response.GetResponseStream()
Using streamReader As New StreamReader(resStream, Encoding.UTF8)
Return streamReader.ReadToEnd()
End Using
End Using
End Using
Catch ex As Exception
InvokeIfRequired(ListBox2, DirectCast(Sub() ListBox2.Items.Add("[" & TimeString & "]:" & ex.Message), MethodInvoker))
Return GET_Request(URL, CC)
End Try
End Function

responseand the result ofGET_Request()as seen from the debugger? This code would return the entire response, so either something outside of this code isn't doing what you expect or the server isn't returning what you expect. (Also, you might want to re-think yourCatchblock. That's an infinite recursion waiting to happen.)