Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WebRequestMethods.Ftp.GetFileSize does not work
Message
De
29/06/2013 15:37:39
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
WebRequestMethods.Ftp.GetFileSize does not work
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01577502
Message ID:
01577502
Vues:
55
I always use this to get the file size of a file before downloading it:
                        ' FTP setup
                        loFtpWebRequest = System.Net.FtpWebRequest.Create(New Uri(lcURI))
                        loFtpWebRequest.Credentials = New System.Net.NetworkCredential(cUsername, cPassword)
                        loFtpWebRequest.Method = System.Net.WebRequestMethods.Ftp.GetFileSize
                        loFtpWebRequest.UseBinary = True
                        loFtpWebRequest.UsePassive = True
                        loFtpWebRequest.KeepAlive = False
                        loFtpWebRequest.Timeout = 10000000
                        loFtpWebRequest.ReadWriteTimeout = 10000000

                        Using loFtpWebResponse As System.Net.FtpWebResponse = loFtpWebRequest.GetResponse()

                            ' Get the length
                            lnContentLength = loFtpWebResponse.ContentLength

                            ' Assign the the public property
                            nSize = lnContentLength

                        End Using
However, on one specific server, this does not work. The Using line cannot be executed and it seems they do not allow us to get the file size of the file.

Anyone knows if this is possible for a FTP server to restrict that? Also, a workaround would be appreciated.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform