ASP.NET Webform not logging through MS Azure AD (SSO authentication)

Azam Shaikh 1 Reputation point
2020-09-17T13:20:30.253+00:00

Hi Team,

I want to implement Azure authentication for my application using OAuth. Once I get the Barrier token I need to use this for other action in my application.

Can anyone provide code snippet for this? I am not using MVC using legacy ASP.NET

I have created the POC but it is woking till the Azure authentication, after authentication it is redirected to my website and getting the "Request.IsAuthenticated" always false and not enter into application.

Please let me know if there are any other settings required

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,908 questions
Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,916 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,107 questions
{count} votes

1 answer

Sort by: Most helpful
  1. soumi-MSFT 11,786 Reputation points Microsoft Employee
    2020-09-17T13:55:07.637+00:00

    @Azam Shaikh , Thank you for reaching out. Unfortunately, we do not have any samples published or available for ASP .Net WebForms. All that is available are MVC applications. You can find the list of available samples here: https://learn.microsoft.com/en-us/azure/active-directory/develop/sample-v2-code

    Having said that, since ASP .NET WebForms uses the traditional an event-driven model, I believe the ASP .NET WPF sample might help.
    Please find the sample here: https://github.com/azure-samples/active-directory-dotnet-desktop-msgraph-v2

    Also, as you mentioned that the error comes up after the user is authenticated as "Request.IsAuthenticated" gets set to false, it would interesting to know, how the app is deciding if the user is authenticated or not. In the case of MSAL.net for ASP .NET MVC application, OWIN middleware gets implemented, which takes care of the Authentication by invoking the OpenIDConnect flow and gets the user authenticated.

    But strongly recommend checking the WPF sample, which might help you or get you some understanding in the way to go ahead.

    Hope this helps.

    Do let us know if this helps and if there are any more queries around this, please do let us know so that we can help you further. Also, please do not forget to accept the response as Answer; if the above response helped in answering your query.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.