Vulnerability in EPiServer.Forms
I'm trying to use Razor Pages instead of good old MVC, and it seems to be should be supported through the use of RazorPageModel on the PageModel. I keep getting 404, and the PageModel.OnGet() never gets called.
public class FrontpageModel : RazorPageModel<FrontPage>
public PageResult OnGet()
While debugging the HttpContext though, I found the ContentRenderingContext and the SelectedTemplate, which looks good. My FrontpageModel does indeed get registered as a TemplateModel for FrontPage, and it is selected when the content is requested. Path on the TemplateModel is null though. But the path for .cshtml view and razor page model is very much the same usually, just omit the .cs. The should be able to find it...
Tried to add a TemplateDescriptor with Path to the .cshtml file anyway, didnt work. it did get registered as a CustomAttribute on the type information, but it did not populate the Path property on the TemplateModel.
Appreciate any tips, havent found any working code using RazorPageModel yet.
Where did you place your Razor page file? By default, the asp.net core runtime look for Razor page file in the /Pages folder. I used Razor pages in one of my demo projects, it works fine.
I hope it helps.
You're right of course, thank you! I was going for feature folders, and thought I tried with the /Pages folder after a while but I think I forgot to update model namespace after copying..
I'll have to figure out a custom convention for feature folders then, but thats a differen post on a differen forum I guess