Note that there are some explanatory texts on larger screens.

plurals
  1. POSystem.Net.FtpWebRequest GetDateTimestamp call dies
    primarykey
    data
    text
    <p>Following test works... </p> <pre><code> public void test1() { string server="ftp://myserver.com/dev"; string userName="myusername"; string password="mypassword"; FtpWebRequest req = (FtpWebRequest)WebRequest.Create( server ); req.Credentials = new NetworkCredential( userName, password ); req.Method = WebRequestMethods.Ftp.ListDirectoryDetails; req.Timeout = 30000; req.UseBinary = false; req.EnableSsl = false; req.UsePassive = false; req.KeepAlive = true; using( FtpWebResponse resp = (FtpWebResponse)req.GetResponse() ) { using (StreamReader sr = new StreamReader(resp.GetResponseStream())) { string fileRecord = sr.ReadLine(); while (fileRecord != null) { Console.WriteLine( fileRecord ); fileRecord = sr.ReadLine(); } } } } </code></pre> <p>While the following test fails... </p> <pre><code> public void test2() { string server="ftp://myserver.com/dev"; string userName="myusername"; string password="mypassword"; FtpWebRequest req = (FtpWebRequest)WebRequest.Create( server ); req.Credentials = new NetworkCredential( userName, password ); req.Method = WebRequestMethods.Ftp.GetDateTimestamp; req.Timeout = 30000; req.UseBinary = false; req.EnableSsl = false; req.UsePassive = false; req.KeepAlive = true; using( FtpWebResponse resp = (FtpWebResponse)req.GetResponse() ) { using( StreamReader sr = new StreamReader( resp.GetResponseStream() ) ) { Console.WriteLine( resp.LastModified ); } } } </code></pre> <p>with error message: </p> <p>Test method test2 threw exception: System.Net.WebException: The remote server returned an error: (550) File unavailable (e.g., file not found, no access). </p> <p>UPDATE: I tried with another ftp site (unix) that uses the default port#, so the url is "<a href="ftp://myserver.com/dev" rel="nofollow noreferrer">ftp://myserver.com/dev</a>" - and the GetDateTimestamp() still dies with the same error. </p> <p>I have updated the subject line and the body of the question to reflect my query properly.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload