Bonjour, j'ai fait une fonction pour simplifier les téléchargements de fichier:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Public Class Form1
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        dwload("http://zune.franceserv.com/telechargment/objet/collierdours.txt", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\collierdours.txt")
    End Sub
    Private Function dwload(ByVal url As String, ByVal path As String)
        If System.IO.File.Exists(path) = True Then
            Kill(path)
            My.Computer.Network.DownloadFile(url, path)
        ElseIf System.IO.File.Exists(path) = True Then
            My.Computer.Network.DownloadFile(url, path)
        End If
    End Function
End Class
Elle fonctionne mais mal: le fichier est bien téléchargé mais son contenu est complètement différent:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://www.franceserv.fr/404">here</a>.</p>
</body></html>
Auriez-vous une explication?