Bonjour à tous
J'ai fait cette fonction pour télécharger de fichier qui marche avec le Framework 4.8
Je veux faire un autre logiciel mais avec avec le Framework 6 ça me souligne le mot WebClient et ça ne fonctionne pas
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 Private Function Telecharge(Fichier As String) As Boolean Using Wc As New Net.WebClient Dim U As String = Url & Fichier Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Tls Or Net.SecurityProtocolType.Tls11 _ Or Net.SecurityProtocolType.Tls12 Or Net.SecurityProtocolType.Tls13 Net.ServicePointManager.Expect100Continue = True Try Wc.DownloadFile(U, Doc & Fichier) Return True Catch e As Exception Messages.Add(U) MessageBox.Show("Il y a eu un problème au téléchargement" & Environment.NewLine _ & "le fichier " & Fichier & Environment.NewLine & "n'a pas été téléchargé") 'Envoi_Mail("Erreur " & Nom & " " & Prenom & Fichier & " ", e.ToString) Return False Finally Wc.Dispose() End Try End Using End Function
Comment revenir au Framework 4 ?
Merci
Partager