I want to display an custom error page for code 401 , if the user is not authorized to view any particular part of my webApplication. Kindly solve my problem.
What I have tried:
This is my web.config file:
This is My Controller:
[HandleError]
public class HomeController : Controller
{
[Authorize]
public ActionResult SecureMethod()
{
return View();
}
[AllowAnonymous]
public ActionResult NonSecureMethod()
{
return View();
}
I have also enabled the Windows Authentication and Anonymous Authentication on IIS Server


Catcher WongRank #286 · 8.8K reputationPosted Aug 16, 2017, 4:46 AM EDT
arvind baldaniyaRank #3,964 · 375 reputationPosted Aug 18, 2017, 11:21 PM EDT