Skip to main content
Participant
July 30, 2024
Question

make https call from acrobat plugin

  • July 30, 2024
  • 1 reply
  • 595 views

Hi,

 

I am getting the below error while making a https request from my Acrobat plugin, also below is the code that is used to make the api call

 

System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.ComponentModel.Win32Exception: No credentials are available in the security package

 

using (var httpClient = new HttpClient(handler))
{
try
{
using var fileStream = File.OpenRead(filePath);
using var requestMessage = new HttpRequestMessage(HttpMethod.Post, uri);
using var content = new MultipartFormDataContent
{
{ new StreamContent(fileStream), "file", "test.pdf" }
};
requestMessage.Content = content;
using var response = await httpClient.SendAsync(requestMessage);
MessageBox.Show(response.StatusCode.ToString());
//response.EnsureSuccessStatusCode();
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
//throw;
}
}

 

 

1 reply

Thom Parker
Community Expert
Community Expert
July 30, 2024

What exactly do you mean by "plug-in"? 

What language are you writing in? and on what platform?

 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
February 25, 2025

We are facing exactly the same issue. We are using dotnet version 6 to make Http calls and those fails with "No credentials are available in the security package" and this fails only in ProtectedMode. It works fine in Non Protected Mode. Any hints if I do need to whitelist some DLL's ?  

Thom Parker
Community Expert
Community Expert
February 25, 2025

Acrobat plug-ins are written in C++. So I have to assume that you did in fact write a plug-in in C++, but are loading a DLL created with C#.  Is this correct? 

 

I have not used C# for HTTP operations in a plug-in, but I have used the Windows API (and with MFC) for this purpose.  I haven't had any issues in either protected or non-protected mode.  So I do not think HTTP operations are the issue. 

 

In protected mode Acrobat blocks access to local system resources that it considers risky. For example, the registry and file system, as well as any executable. Since .Net is a local executable, it makes sense that it would be blocked.  I'm just speculating here. I'd suggest that you consider either accessing HTTP through the Windows API directly, or use a Broker to handle protected mode. 

 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often