0

Where does sql asp net mvc stores role access in a sql database if it actually does?

I found information regarding user membership and roles but not about access rules.

Guilherme Longo
  • 2,278
  • 7
  • 44
  • 64

1 Answers1

1

You should do some research on the SqlMembershipProvider. There's a good tutorial on the schema it creates on the ASP.NET website.

In short, if you use the aspnet_regsql.exe tool, the appropriate tables will be created in your database, prefixed with 'aspnet_'.

Edit:

As for access rules, those are not stored in the database. In MVC, authorization is generally accomplished in code using the Authorize attribute, either at the action level or sometimes for an entire controller.

public class HomeController : Controller
 {
     public ActionResult Index()
     {
         return View();
     }

     public ActionResult About()
     {
         return View();
     }

     [Authorize]
     public ActionResult AuthenticatedUsers()
     {
         return View();
     }

     [Authorize(Roles = "Admin, Super User")]
     public ActionResult AdministratorsOnly()
     {
         return View();
     }

     [Authorize(Users = "Betty, Johnny")]
     public ActionResult SpecificUserOnly()
     {
         return View();
     }
 }
Eric King
  • 11,594
  • 5
  • 43
  • 53
  • I know that... As I wrote earlier I found information regarding user membership and roles in that structure but not about access rules. – Guilherme Longo Nov 20 '12 at 16:37
  • @user1827417 Ok, then I guess I don't understand what you mean by 'access rules'. Can you clarify? – Eric King Nov 20 '12 at 20:43
  • @user1827417 Also see related: http://stackoverflow.com/questions/6983558/store-asp-net-access-rules-on-sql-server – Eric King Nov 20 '12 at 23:30
  • I can select a folder and set users ou role to access this folder. The folder has a path and I presume the system need to store that information somewhere in the database to check if a user or a group has permission to access this folder. Where this information is kept? I don´t see any folder path in my database. This was my question. – Guilherme Longo Nov 21 '12 at 02:02
  • Thanks. I found the attribute. – Guilherme Longo Nov 21 '12 at 10:15