I had the same problem, I found the parameter in the project properties, but I am creating a Windows application, so I can not change the type of application.
This is the code I'm using.
Dim t As Task = New Task(AddressOf DownloadPageAsync) t.Start() Console.WriteLine("Downloading page...") Console.ReadLine()
Async Sub DownloadPageAsync ()
Using client As HttpClient = New HttpClient() Using response As HttpResponseMessage = Await client.GetAsync(page) Using content As HttpContent = response.Content ' Get contents of page as a String. Dim result As String = Await content.ReadAsStringAsync() ' If data exists, print a substring. If result IsNot Nothing And result.Length > 50 Then Console.WriteLine(result.Substring(0, 50) + "...") End If End Using End Using End Using
End sub
source share