Skip to main content
Participant
Jul 30, 2024 6:01 PM UTC
Question

make https call from acrobat plugin

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;
}
}

 

 

5 replies

Thom Parker
Community Expert
Community Expert
Jul 30, 2024 8:11 PM UTC

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

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

 

 

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
Feb 25, 2025 12:28 PM UTC

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 ?  

Translate
Thom Parker
Community Expert
Community Expert
Feb 25, 2025 5:25 PM UTC

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. 

 

 

 

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