Home > Enterprise >  Blazor scaffolded registration page why .cshtml not .razor file?
Blazor scaffolded registration page why .cshtml not .razor file?

Time:09-25

When blazor (server-side) Identity pages are scaffolded we get cshtml pages, not blazor page components. I'm quite curious why it is cshtml and not a razor page component and if that is a good idea to rewrite that to blazor page components (for example to make some UI improvements). Of course, my biggest concern is security. Maybe that was the reason why that is generated that way.

CodePudding user response:

I think there are two main reasons:

  1. Microsoft already had an Identity and an Identity UI available for MVC and Razor Pages . It's quite extensive with 2FA, external logins, User account management etc.

  2. Blazor by itself cannot be used for a cookie (HttpContext) based solution.

The 'switch' that a user has to make between Blazor and the Razor Pages has the side benefit of refreshing the cookie.

You could write your own UI in Blazor but then you'd have to implement (replace) a lot of the Identity system as well. Everything depending on HttpContext or cookies.

  • Related