How do I define object base authorization in ASP.NET MVC?
I am creating an application for a video gallery, wh开发者_Python百科ere I have different types of cds like audio, video, songs, movies etc. I need to give users access to only some of the cds types, for example only songs and movies.
How can i achieve this in ASP.NET MVC?
public class ViewCDsController : BaseController
{
[Authorize(Users="A")]]
public ActionResult MovieType
{
//select only the correct CDs to return to the view
return View();
}
}
check this page for more information http://www.asp.net/mvc/tutorials/authenticating-users-with-forms-authentication-cs
精彩评论