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());
}
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
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.
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());
}