MVC-3 ASP.NET Shared Views-Redirect-Razor

I have a general view called NotAuthorized in the "Views / Shared" folder. I want to redirect users to this view when they are not allowed to see the page.

This view was originally in the Account folder. But I moved it to the General folder, because I no longer use the account. I deleted the Account folder.

I used the following code to redirect:

public ActionResult NotAuthorised()
{  
   return RedirectToAction("NotAuthorised", "Account");
}

Now that I have deleted the Account folder, I am trying to use

public ActionResult NotAuthorised()
{  
   return RedirectToAction("NotAuthorised", "Shared");
}

I am completely wrong in specifying the folder name shared on the last line.

Can someone tell me what I am doing wrong?

thank

+3
source share
1 answer

View, Action Controller. , .

public class AuthorizeController : Controller
{
    public ActionResult NotAuthorised()
    {  
       return View("NotAuthorised");
    }
}

:

return RedirectToAction("NotAuthorised", "Authorize");

Controller. View

public ActionResult NotAuthorised()
{  
   return View("NotAuthorised");
}
+9

All Articles