Configure authorization redirection
Not sure if it helps, but I downloaded VS 2015 RC.
Ive created a new MVC 6 project and started (F5). unauthenticated , I tried to achieve ManageController
which is decorated with the attribute [Authorize]
.
Needless to say, I was redirected to view the account / login, but I couldn't find anywhere where this is configured.
I was able to add the following to the ConfigureServices()
method Startup.cs
:
services.Configure<CookieAuthenticationOptions>(options =>
{
options.LoginPath = new PathString("/Gazou/Index");
});
A little higher:
services.AddMvc();
Then I created a new one GazouController
with a simple one Index IActionResult()
.
The reapplication tried to access again ManageController
, but this time I was redirected to a method of Index
mine GazouController
instead of the default behavior.
Hope this helps. Vince
source to share