I really new in this vb.net programing, still need lot of learning, heed some help here, so I try to use HTTPCLIENT to get data from website and the result is json, I'm able to get the body using this code
Dim node As String
Dim client As New HttpClient
Dim getStringTask As Task(Of String) = client.GetStringAsync("urltarget")
node = Await getStringTask
textbox1.text = node
I can display the json file in textbox1, but my question is how I can get the header response on textbox2 since the node result only contain the body
CodePudding user response:
Calling GetStringAsync() only returns a simple string. Try this to get access to the whole response:
Dim client As New HttpClient
Dim response = Await client.GetAsync(url)
TextBox1.Text = Await response.Content.ReadAsStringAsync()
TextBox2.Text = response.Headers.ToString()