Troubleshooting 'Access Denied' Error in Conversion API for .NET: Resolving Server Permissions

Error: ‘Access to the path ‘C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\Windows\INetCache\Content.IE5’ is denied.’

Here is the code converter.Convert is throwing the above error message on the server when running locally it is working as expected not sure what needs done on the server and why does it need access to that directory?

List<MemoryStream> ms = new List<MemoryStream>();
int index = 0;

// Create a new instance of the Converter class with the specified fileName
using (Converter converter = new Converter(fileName))
{
    // Convert the file using the Converter object
    converter.Convert(() => new MemoryStream(), (string sourceFileName, FileType ft, Stream convertedStream) =>
    {
        // Add a new MemoryStream to the ms list
        ms.Add(new MemoryStream());
        // Copy the convertedStream to the MemoryStream at the current index
        convertedStream.CopyTo(ms[index++]);
    }, new PdfConvertOptions());
}

Using:
GroupDocs.Conversion 23.6.0
GroupDocs.Merger 23.5.0

1 Like

@BSkoloda

Could you please share the full server details with us?
This issue can occur due to insufficient permissions or restrictions on the server that prevent the application from accessing the directory.
Have you tried specifying an alternate directory or running the application as an administrator?

Windows Server 2019 Standard
Installed memory (RAM) 8.00 GB
SystemType 64-bit

The service is running as an Administrator on the server

I never added that directory in my code any where not sure where it is coming from? Can I override that directory and use my own or not use a physical directory at all and just use a memory stream

@DRS123

We are investigating this issue, opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CONVERSIONNET-6182

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

FYI I was able to use the Paid Support under the company account - Containerize.IdentityServer - Single sign-on to access all applications and services of Aspose Pty Ltd.

1 Like

@DRS123

Got it.

This ticket will be assisted on priority basis.

With the help of Support this coding change resolved the issue:

using (var converter = new Converter(fileName, () =>
{
    // Customize ConverterSettings
    var settings = new ConverterSettings();
    // Clear font directories
    settings.FontDirectories.Clear();
    // Return the customized settings
    return settings;
}))
{
    // Convert the file using Converter
    converter.Convert(() => new MemoryStream(), (string sourceFileName, FileType ft, Stream convertedStream) =>
    {
        // Create a new MemoryStream to store the converted data
        ms.Add(new MemoryStream());
        
        // Copy the converted data to the MemoryStream
        convertedStream.CopyTo(ms[index++]);
    }, new PdfConvertOptions());
}

Thanks

2 Likes

@DRS123

Great to hear that the issue has been resolved.