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

Announcements

News and Announcements icon
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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans