550 mydir:cannot create a file when that file already exists.
How can I retrieve the above message in my application? When I tried I got
the following error from my application:
The remote server returned an error: (550) File unavailable (e.g., file not
foun
d, no access).
The code is mentioned below for your reference:
static void CreateFTPDirectory(string dirName, string ftpURI)
{
Console.WriteLine("{0} : Creating directory {1} at {2}...",
DateTime.Now, dirName, ftpURI);
string requestURI = ftpURI + "/" + dirName;
//the ftp request object
ftpRequest = (FtpWebRequest)WebRequest.Create(requestURI);
ftpRequest.Credentials = new NetworkCredential("ituser",
"Comp68A");
ftpRequest.Method = WebRequestMethods.Ftp.MakeDirectory;
try
{
//the ftp response object
ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
}
catch (WebException ex)
{
//WebResponse response = ex.Response;
//using (StreamReader rdr = new
StreamReader(response.GetResponseStream()))
//{
// Console.WriteLine(rdr.ReadToEnd());
// rdr.Close();
//}
Console.WriteLine(ex.Message);
return;
}
Console.WriteLine("{0} : {1}", DateTime.Now,
ftpResponse.StatusDescription);
}
I've tried reading from the response stream (look commented code) but got
nothing.
--deostroll
response.StatusCode,
response.StatusDescription
where response is the FtpWebResponse object
Regards
Rajkiran
"deostroll" <deos...@discussions.microsoft.com> wrote in message
news:677C8414-8ABC-43B0...@microsoft.com...