web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to connect Asp net core app to dynamic CRM 365

(0) ShareShare
ReportReport
Posted on by 195

Hi can anyone give me some suggestion i need to call Dynamic 365 Api through my asp core app, but i found some several tutorial but i can't make it works. Can anyone give me best practices to do that in asp net core.  Here is my code below its not highlight any error but when i try to run it  it give me this error message Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

public string GetAuthToken()
{

// TODO Substitute your app registration values that can be obtained after you
// register the app in Active Directory on the Microsoft Azure portal.
string clientId = ""; // Client ID after app registration
string userName = "";
string password = "";
UserCredential cred = new UserCredential(userName, password);

// Authenticate the registered application with Azure Active Directory.
AuthenticationContext authContext = new AuthenticationContext("login.windows.net/common", false);
AuthenticationResult result = authContext.AcquireToken(serviceUri, clientId, cred);
return result.AccessToken;
}


*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at

    Hi There,

    Could you please tell me what is your .net core version , it should be 2.0.

    also other thing you can try is to reload dll ( from nuget).

  • Keysersozeey Profile Picture
    195 on at

    Im using Net core 2.2 right now

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans