Does my ASP.NET MVC application need an "Administrator" Area?

I'm basically making a shopping cart in asp.net mvc. I'm adding an administrator section where the admins can:

  • CRUD on Products.
  • CRUD on Users.
  • RUD on Orders.
  • Do I need to create an Administrator Area in the mvc project for admins, is it suited for my needs? What are the benefits of an Area ?


    You could use an Area . If your needs are likely to expand in the near future, then it might make sense. However, as of now your needs are fairly simple, and it seems like it would be easier to create a ProductController , a UserController and a RUDController , then apply an AuthorizationFilter to the "administrator" actions. I suggest you start this way, and if you need to add additional functionality in the future, then you can refactor the functionality to an Area. At this point, it would probably just be making unnecessary work for yourself.

    EDIT: When I first started learning about MVC I read a blog post by Rob Conery that explained how to approach this problem. I just looked through my bookmarks and found it for you. I think you'll find it helpful: http://blogs.msdn.com/b/rickandy/archive/2011/05/02/securing-your-asp-net-mvc-3-application.aspx

    链接地址: http://www.djcxy.com/p/61858.html

    上一篇: Java MVC区域的Java等价物

    下一篇: 我的ASP.NET MVC应用程序是否需要“管理员”区域?