Closed hishamco closed 2 years ago
Check the ASP.NET Core Docs
services.AddRazorPages(options =>
{
options.Conventions.AuthorizePage("/Contact");
options.Conventions.AuthorizeFolder("/Private");
options.Conventions.AllowAnonymousToPage("/Private/PublicPage");
options.Conventions.AllowAnonymousToFolder("/Private/PublicPages");
});
I'd already seen this mdsm page. But it's consuming "Policies" not "Roles" like your great post http://hishambinateya.com/role-based-authorization-in-razor-pages I just wanted to say to you that in the code of your extension method AuthorizeFolder(), there is a call to conventions.AddPageApplicationModelConvention(..) instead of conventions.AddFolderApplicationModelConvention(). (Note the diff between AddPageXxx/AddFolderXxx) Only that.
Thanks a lot @neilbgr, fixed in https://github.com/hishamco/hishambinateya.com/commit/dedede57389fa2f080860fd12b90ccc81d17ee71
Hi! For your
AuthorizeFolder()
must beconventions.Add**Folder**ApplicationModelConvention(...
instead ofconventions.Add**Page**ApplicationModelConvention(...
, isn't it ? Thanks for your post. Neil.