开发者

How do I define object base authorization in ASP.NET MVC?

开发者 https://www.devze.com 2023-01-06 14:38 出处:网络
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,

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

0

精彩评论

暂无评论...
验证码 换一张
取 消