AuthenticateWithApp throwns NullReferenceException since today

痴心易碎 提交于 2019-12-02 11:59:21

Stumbled upon that one too, today. Requests in postman worked Podio .NET library failed. It's caused by an API update by Podio, like @Sara said. Seems my system (and yours too) still defaults to Tls 1.0

Add this at beginning of Main(). This will force at least Tls 1.1.

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;

Alternatively you could also set the default like described here:

https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls

We have the same issue, we fixed this by modified the library. Most of our project which uses Podio Sync library. Podio Sync library belongs to Dotnet framework 4.0, so we added a line of code to set default security protocol.

ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072;

The changes are done in Podio.cs file line 76

private T Request<T>(RequestMethod requestMethod, string url, dynamic requestData, dynamic options = null)
            where T : new()
        {
            Dictionary<string, string> requestHeaders = new Dictionary<string, string>();

changed to

 private T Request<T>(RequestMethod requestMethod, string url, dynamic requestData, dynamic options = null)
            where T : new()
        {
            ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072;

            Dictionary<string, string> requestHeaders = new Dictionary<string, string>();

Hope this will help..


The solution for the SecurityProtocol issue can be found C# HttpWebRequest The underlying connection was closed: An unexpected error occurred on a send

I could fix this issue today. The hint on the protocol from @derpirscher was helpful. Because we use .Net 4.0, i had to play around a little bit. But then i came up with this line:

ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072;

I inserted this line in the Page_Load-Method of my Default.aspx-Page.

Now the calls to Podio-API are working correctly again. Thanks for help!

Regards Tony

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!