File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
samples/snippets/fsharp/lang-ref-2 Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
1
open System.Net
2
2
open Microsoft.FSharp .Control .WebExtensions
3
+ open System.Net .Http
3
4
4
5
let urlList = [ " Microsoft.com" , " http://www.microsoft.com/"
5
6
" MSDN" , " http://msdn.microsoft.com/"
@@ -10,8 +11,8 @@ let fetchAsync(name, url:string) =
10
11
async {
11
12
try
12
13
let uri = new System.Uri( url)
13
- let webClient = new WebClient ()
14
- let! html = webClient.AsyncDownloadString ( uri)
14
+ let httpClient = new HttpClient ()
15
+ let! html = httpClient.GetStringAsync ( uri) |> Async.AwaitTask
15
16
printfn " Read %d characters for %s " html.Length name
16
17
with
17
18
| ex -> printfn " %s " ( ex.Message);
@@ -24,4 +25,4 @@ let runAll() =
24
25
|> Async.RunSynchronously
25
26
|> ignore
26
27
27
- runAll()
28
+ runAll()
You can’t perform that action at this time.
0 commit comments