15,897,315 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 8652090 (Top 4 by date)
Member 8652090
16-Feb-12 16:18pm
View
Even more investigation reveals that my last statement wasn't accurate, as the most recent date that I could find for which the year was returned was 08/08/2011, while the oldest date for which the year was not returned was 09/23/2011. However, all dates include the year when viewing the directory in the browser. It seems that the year is included for all dates that are older than six months, but I have no idea why.
Member 8652090
16-Feb-12 15:58pm
View
Dave, further investigation seems to suggest that the year is not returned for files with a date that lies within the past 12 months, but is returned for all dates that are older than one year. Thus 12/02/2011 does not return the year, but 02/02/2011 does. I am very surprised by this, but I am at least happy that I seem to have found an explanation. Thanks for your help.
Member 8652090
16-Feb-12 14:43pm
View
The code was actually taken from this site, and was created by Howard Richards. The link to his code on this site is http://www.codeproject.com/Articles/11991/An-FTP-client-library-for-NET-2-0?msg=4159380#xx4159380xx.
However, code as simple as the following still has the same problem.
Dim ftp As FtpWebRequest = DirectCast(WebRequest.Create(Path), FtpWebRequest)
ftp.Method = WebRequestMethods.Ftp.ListDirectoryDetails
ftp.Credentials = New NetworkCredential(username, password)
ftp.Proxy = Nothing
ftp.KeepAlive = False
Dim fwResponse As FtpWebResponse = DirectCast(ftp.GetResponse(), FtpWebResponse)
Dim srResponse As New StreamReader(fwResponse.GetResponseStream)
Dim strResponse As String = srResponse.ReadToEnd
srResponse.Close()
I apologize if I have not submitted the code in the correct way. The strResponse returns the string with everything that you would expect, except for the year in each file's date.
Member 8652090
16-Feb-12 13:51pm
View
Unfortunately the same happens for dates from 2011. For example, the date that appears as 12/02/2011 08:25PM in the browser, appears as Dec 2 20:25 in the streamreader. I am confident that it is not the fault of the code, as the code has been posted on several sites regarding the use of FtpWebResponse and StreamReaders, and even if I make no changes to the code, the same problem arises. My only alternative at the moment is to use WebRequestMethods.Ftp.GetDateTimestamp for every file in the directory, but I certainly do not want to resort to doing that for a directory with numerous sub-directory levels.