Is there a way to connect .Net WebForms Identity Framework with ASP.net Core WebApi?

Warren Churulich 21 Reputation points
2021-07-13T06:37:33.49+00:00

I have a project using .Net WebForms Identity Framework. However, I want to start using some data from ASP.Net Core WebApi.
Is there a way to use the logged in information from the .Net WebForms for authentication in the Asp.net Core WebApi project?

For example: John logged into the .Net WebForms website that is using the Identity Framework with a local database . Now a page on the WebForms site requests information on the backend from the ASP.net Core WebApi.

Is there a way to make sure that the ASP.net Core WebApi only accepts requests from a valid logged in user on the .Net WebForms site?

I hope this makes sense.
Thank you in advance.

Warren

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,079 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,220 questions
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 53,501 Reputation points
    2021-07-13T14:39:01.333+00:00

    You have two issues.

    The first is how the web form app passes the user login information to the web api site. Typically this is done with a header.

    The second is how the webapi verifies that the call is from the web form application, and not another source. You can use certificates, point to point firewall rules, authentication (different from the web form authentication), or shared encryption keys.

    Another approach is to use a jwt token created by the web form application, that it passes to the webapi application when it makes a call. The webapi application then calls back to the web form application (login server) to verify the jwt token or uses shared encryption keys.

    0 comments No comments

0 additional answers

Sort by: Most helpful