Subject: Permission denied while downloading file using function DownloadFile
Date: 2023-04-19 14:04:23
From: vikram.pote.anju
Source: permission-denied-downloading-file-using-function-downloadfile
----------------------------------------------------------------------

Below is the exception we are receiving from ComponentPro

Exception Title => Permission denied. 

Exception Stacktrace  =>

     at c_bo.c_32f482aa(c_ew , Type )
               at c_bo.c_e8ccc172(String , c_bq , Boolean , AsyncOperation )
               at ComponentPro.Net.Sftp.c_7077e6fa(Boolean , ProgressFileItem , Stream , AsyncOperation )
               at ComponentPro.IO.FileSystem.CopyToSync(ProgressFileItem currentProgressFileItem, AsyncOperation asyncOp)
               at ComponentPro.Net.Sftp.DownloadFile(String remotePath, Stream outputStream)
               at ANJU.BUS.Common.Functions.DownloadFile(String server, Int32 port, Int32 timeOut, String userName, String password, String fileTransferType, Int32 blockSize, String remotePath, String fileName, String& outputMessage)
               at __DynamicCode.Typeed0c2929df644c5bd67c0d27f66e32.OnExecute(PipelineContext`1 context) in c:\Solution\Working\VAL\1utxysrn.0.cs:line 564



Code => 

          try
                {
                    ftpClient = GetSFTPConnection(server, port, timeOut, userName, password, fileTransferType, blockSize, false);// This will Connect and Authenticate client
    
                    if (ftpClient != null)
                    {
                        string remoteFileName = ftpClient.CombinePath(remotePath, fileName);
    
                        using (MemoryStream memoryStream = new MemoryStream())
                        {
                            ftpClient.DownloadFile(remoteFileName, memoryStream);
    
                            if (memoryStream != null && memoryStream.Length > 0)
                            {
                                memoryStream.Position = 0;
                                return Convert.ToBase64String(memoryStream.ToArray());
                            }                            
                        }
                    }                    
                }
                catch (Exception e)
                {
                   throw e;
                }

Is there any other way to get detailed error message instead of just Permission Denied?

Or is there any other issue here from Component Pro side?

----------------------------------------------------------------------

Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand
If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor
who sold you the license and ask for your money back.

Back to ComponentPro Q&A Forum Index