Yes i am able to access the ftp server from the location where Ax is running
code
//in the code i am not getting response, refer the comment.
private void getFTPDirFilesList()
{
container conFTPFilesDownload;
ListIterator ftpFilesListIterator;
// Marshaling .NET to X++
ftpObject = System.Net.WebRequest::Create(ftpHostName);
ftpWebRequest = ftpObject;
if (ftpWebRequest)
{
ftpWebRequest.set_KeepAlive(false);
ftpWebRequest.set_UsePassive(true);
ftpWebRequest.set_UseBinary(true);
ftpWebRequest.set_Timeout(ftpTimeOut);
ftpWebRequest.set_Method(#ListDirectory);
this.setFTPCredentials();
ftpWebResponse = ftpWebRequest.GetResponse();
//-------------code is not running after this line.----------------------------------//
if (ftpWebResponse)
{
ftpFilesList = new list(Types::String);
// BP Deviation Documented
ioStreamReader = new System.IO.StreamReader(ftpWebResponse.GetResponseStream());
if (ioStreamReader)
{
strReadLine = ioStreamReader.ReadLine();
while (!System.String::IsNullOrEmpty(strReadLine))
{
ftpFilesListIterator = new Listiterator(strsplit(strReadLine, '/'));
while (ftpFilesListIterator.more())
{
conFTPFilesDownload += ftpFilesListIterator.value();
ftpFilesListIterator.next();
}
ftpFilesList.addEnd(conPeek(conFTPFilesDownload, conlen(conFTPFilesDownload)));
strReadLine = ioStreamReader.ReadLine();
}
ioStreamReader.Close();
}
if (ftpFilesList.empty())
{
warning (strfmt("No files available in %1", ftpHostName));
}
}
}
}