Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WebRequestMethods.Ftp.GetFileSize does not work
Message
From
29/06/2013 15:37:39
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
WebRequestMethods.Ftp.GetFileSize does not work
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01577502
Message ID:
01577502
Views:
54
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
Next
Reply
Map
View

Click here to load this message in the networking platform