question

Nita-3264 avatar image
0 Votes"
Nita-3264 asked AgaveJoe answered

How to share login/Role between 2 standalone web application in .net/C#?

I have a Web application that have simple Authentication, User table with Hash password and salt, Role and User Role table, the application is older application with asp.net. I am working on new standalone application in .net core.

I am going to have a link in first application by clicking on that I would pass login and user will login Automatically instead of going to login page,

Also user can go to the login page and login, so I will get the user info and Role from same Database and tables. What is the best way to approach this?

1- Do I need to use any Authentication approaches like Identity sever, Owin,….
2- Or I can simply generate a token in first application save that in user table
along with user info and token expiration date, in second application check for
that token and if it is valid I log he user if not redirect to login page?

dotnet-csharp
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

AgaveJoe avatar image
0 Votes"
AgaveJoe answered

I've used option 1 and 2. Either approach is fine with option 1 being larger effort but worth it if you intend to add sites in the future. Another option to look into is sharing the authentication cookie between sites.

Share authentication cookies among ASP.NET apps


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.