Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

make https call from acrobat plugin

New Here ,
Jul 30, 2024 Jul 30, 2024

Copy link to clipboard

Copied

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

 

 

TOPICS
Windows

Views

243
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 30, 2024 Jul 30, 2024

Copy link to clipboard

Copied

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

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

 

 

 

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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 25, 2025 Feb 25, 2025

Copy link to clipboard

Copied

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 ?  

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2025 Feb 25, 2025

Copy link to clipboard

Copied

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

Thanks for replying Thom Parker. Yes I have ultimately used WinInet to make internet calls and even it works for me. The thing I was worried about was, why dotnet dll calls were getting blocked. Even opening a simple TCPClient socket was restricted. But yeah WinInet.dll works fine . Thanks for the help.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

LATEST

As stated in my response, ".Net" is an executable in the local file system, which is restricted in protected mode. I suspect that  ".Net" itself is blocked. But even if it is not, then maybe it is doing something on the local file system to open the socket that Acrobat doesn't like.  Your guess is as good as mine. 

 

 

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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines