I'm migrating from ASP MVC Classic to ASP Razor Pages.
Only one controller left to "migrate": HomeController
public class HomeController : Controller
{
UserManager<WebUser> _userManager;
public HomeController(UserManager<WebUser> _userManager)
{
this._userManager = _userManager;
}
[Authorize]
public async Task<IActionResult> Index()
{
var user = await _userManager.GetUserAsync(User);
if (user == null)
{
return RedirectToPage("/Account/Login", new { area = "WebUserIdentity" });
}
return RedirectToPage("/Index", new { area = "Downloads" });
}
}
There is no corresponded view to this controller/action.
And because of this I'm in stuck: how to configure routing for razor pages to use those redirects (to two different areas) without creating "fake" Index page?