I am using Minimal API in ASP.NET Core. I need to return a Razor page. Is there any way to do this?
I have added
builder.Services.AddRazorPages();
app.MapRazorPages();
in program.cs file. And I have index.cshtml file under the root Page folder, but it doesn't work:
public async static Task<RedirectToPageResult> Get()
{
return new RedirectToPageResult("index");
}



return razor page? Do you want to add two more calls -AddRazorPages()andMapRazorPages()- for supporting Razor Pages ? If so, you can add Pages folder under the project root. And add a new Razor Page named Index.cshtml to it.