I have a .NET 6 application that is configured to use identity for authorization and would like to test other controllers in the application. I've tried using postman but the request keeps returning a 404 error.
I tried using postman interceptor to capture the credentials from the request but could not figure out how to use them.
I also tried setting up the app to use cookies but nothing seems to be happening.
builder.Services.ConfigureApplicationCookie(options =>
{
options.LoginPath = "/Account/Login";
options.AccessDeniedPath = "/Home/AccessDenied";
});
Do you add below code to your Program.cs?
builder.Services.AddControllersWithViews();
...
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
You can have a look at Routing to controller actions in ASP.NET Core to know more.
Try to add the above route for mvc.