How to prevent user from access my web application without login blazor ?

Ahmed Salah Abed Elaziz 390 Reputation points
2023-04-07T03:10:36.16+00:00

I work on blazor server side . i face issue i can't redirect user to login page when he try to access web application my scenario as below : 1-i open my web application as www.union.com .

2-it open login page as first page

3-i make login it log successfully then it open dashboard page after login success as www.union.com/Dashboard/AElaziz

AElaziz is user name

4-i copy this link and open new page on google chrome and past it then run page

it open dashboard without login

so How to prevent this behaviour form happen on blazor server side ?

also if there are easy solution without without using identity please provide me

Developer technologies | ASP.NET | ASP.NET Core
Developer technologies | .NET | Blazor
Developer technologies | ASP.NET | Other
{count} votes

Your answer

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