title: How do I manually set a user's role in ASP.NET MVC?
body: <p>This project I'm working on requires me to keep a local db of admin users and use an external db for regular users.  Anyone who passes authentication in the admin db should be assigned the 'admin' role, and anyone authenticated through the other db will always be assigned a 'user' role.</p>
  
  <p>Can I manually assign these roles?  I don't need the complexity of a Role Provider or anything, since I'm only using these two roles which will ALWAYS be based on which db they authenticate with.</p>
  
  <p>It would be a HUGE help if you could provide sample code or a link to some documentation.  Thanks!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Currently I am not using the role provider and creating one seems like a hassle.  I know its not 'best-practice', but I only need to assign 1 of 2 roles during login (this will never change).  It also doesn't make sense to store role information in the database, since users are already separated into 2 dbs by their role.</p>
  
  <p>Here's some pseudo-code:</p>
  
  <pre><code>if (AdminDB.ValidateUser(username,password)==true) {
       SetAuthCookie(username);
       AssociateUserWithRole(username, 'admin');
  } elseif (UserDB.ValidateUser(username,password)==true) {
       SetAuthCookie(username);
       AssociateUserWithRole(username, 'user');
  } else {
       // Login failed.
  }
  </code></pre>
  
  <p>Its the 'ThisSession.AssociateUserWithRole' part I don't know.  Basically, one the user is authenticated, I need to tell .NET which role the user belongs to.</p>