Asp – how do i can swich the view based on the logged in user in mvc asp.net

asp.net-mvcauthentication

I need to either redirect user or show not authorized page according to usertype of the logged in user.

Here is some which would give you an idea.

public ActionResult Index()
{
    if (Request.Cookies["isadmin"].Value != "true")
        return View("NotAuthorized","Index");
    else
        return View();
}

Here I have created new view with NotAuthorized as view name and projectname.Models.NotAuthorized as strongly type view.

after building and running the project,it give me following error.

Parser Error Message: Could not load type 'System.Web.Mvc.ViewPage'.

Best Answer

Are you using the final version? Did you created the project using the VS template? Also, check your project references.