question

DmitriyReznik-4665 avatar image
0 Votes"
DmitriyReznik-4665 asked DmitriyReznik-4665 commented

Cannot add Azure B2C authentication to Asp.Net WebForms application

I have an Asp.Net 4.7 WebForms legacy application written in vb.net. Currently it uses Microsoft.AspNet.Identity for authentication. But we need to switch to Azure B2C authentication. I tried to follow various instructions I could find, e.g. https://github.com/Zen3InfoSolutions/B2C-WebForms-DotNet, but nothing works for me. I cannot even compile the application. Is it even doable for a vb.net application?

I created everything needed in Azure, so I have what to add to web.config:

  <!-- Azure AD B2C Settings -->
  <add key="ida:Tenant" value="mytenantb2c.onmicrosoft.com" />
  <add key="ida:ClientId" value="7jg87k77-a45i-9o7d-n123-jggr2y7il777" />
  <add key="ida:AadInstance" value="https://login.microsoftonline.com/{0}/v2.0/.well-known/openid-configuration?p={1}" />
  <add key="ida:RedirectUri" value="https://localhost:44316/signin-oidc" />
  <!--<add key="ida:SignUpPolicyId" value="<<signup-policy-name>>" />-->
  <add key="ida:SignInPolicyId" value="B2C_1_signin" />
  <!--<add key="ida:UserProfilePolicyId" value="<<editprofile-policy-name>>" />-->
azure-ad-b2cdotnet-visual-basicdotnet-aspnet-webforms
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

alfredorevilla-msft avatar image
1 Vote"
alfredorevilla-msft answered DmitriyReznik-4665 commented

Hello @dmitriyreznik-4665, the github sample works fine. It should work with VB.NET too. If it does not compile, then you need to check for errors on the Visual Studio Error List or MS Build ouput. Finally, replace https://login.microsoftonline.com with https://<B2C TENANT>.b2clogin.com.



Let us know if this answer was helpful to you or if you need additional assistance. If it was helpful, please remember to accept it so that others in the community with similar questions can more easily find a solution.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@alfredorevilla-msft A am sorry, it was my mistake. It was not a compilation error, but a runtime error:

Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

0 Votes 0 ·