Access to path denied - over network

282 views Asked by At

Image Compression: We have 2 different servers on the same network Server A has document folder where all the documents are saved. Server B has the code which tries to access the documents on Server A and then compress it.

Error: Access to path denied My path --> \\ServerName\E$\ClientFiles\SHAH\SHAH_103696_20220531160805_2600.jpg

The folder and all its contents have been given full permissions. I also added Network Service and gave full permissions

public void ImageCompressionStream(ShahImages fileImage)
{          
    try
    {                
        using (WebClient webClient = new WebClient())
        {
            byte[] data = webClient.DownloadData(fileImage.filePath);

            using (MemoryStream mem = new MemoryStream(data))
            {
                using (var yourImage = Image.FromStream(mem))
                {
                     yourImage.Save(fileImage.filePath, ImageFormat.Jpeg);
                }
            }

        }
    }
    catch (Exception ex)
    {
         
    }
}
0

There are 0 answers