November 2016
Intermediate to advanced
326 pages
6h 1m
English
For the sake of explanation, let us assume that the About page is a secure page and only authenticated users should be able to access it.
We just have to decorate the About action method in the Home controller with an[Authorize] attribute:
[Authorize]
public IActionResult About()
{
ViewData["Message"] = "This is my about page";
return View();
}
Making the preceding change will redirect the user to the log-in page when the user tries to access the log-in page without logging in to the application:

In the following screenshot, you will notice an additional query parameter, ReturnURL, in the URL. This ReturnURL ...
Read now
Unlock full access