How to force FormAuthentication to refresh the users roles?

I'm trying to figure out how when using the default asp.net forms authentication stuff one can change the roles that a user has dynamically. In our case a user has access to many accounts and there roles can change per account. This doesn't seem like rocket science to me but I can't figure out I would do this. Does anyone have a experience trying to do this or a link that would be helpful?

UPDATE:

Just to clarify. We know at startup that User X has access to account #1 with roles 1,2,3 and account #2 with roles 1,2.

So first off I have to handle this part of the problem. Getting their roles based off their current account. For this I think I'd use a RoleProvider. The problem I'm trying to solve though is once ASP.Net has a User how do I tell it to invalidate that user or refresh that user so it would hit my custom RoleProvider (or what not) again.

Answers


Roles.AddUserToRole() should take care of adding the user to a role.

For removing: Roles.RemoveUserFromRole()

http://msdn.microsoft.com/en-us/library/system.web.security.roles.aspx


Need Your Help

PHP MYSQL search string everyhwere

php mysql

Is it possible to search a string in table without specifing column?

SQL, php pdo and retreiving table rows

php html sql pdo

I have a really big problem right now and I cant find a solution for it, so I was hoping to get some help.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.