views:

214

answers:

1

Hello. I'm new to implementing custom membership/roles for ASP.Net MVC 2. I have membership/roles working in that a user can login successfully and can retrieve their role assignments. However, if I change their role assignments in the underlying database, those changes are not propagating through to the app. I removed all role assignments for said user and when they login, they still have the same role assignments they had before I deleted the assignments in the database.

I'm using Entity Framework 4 for user/role retrieval. I created a test that calls the same code for getting a user by name and this test successfully returns the correct role assignments each time, regardless of what mods I make at the database. So this rules out any EF cache.

I also removed all caching at the browser level (I'm using Firefox 3.6.8) and I have the same issue.

So, this seems to be a custom membership/role caching issue. What setting am I missing?

Thanks in advance for your help.

A: 

Welcome to SO.

When you say you are using EF for user/role retrieval, do you mean you have a custom provider rolled? I would look here for possible caching. At the very least, if you restart the web server does the caching go away?

JasonCoder
Yes, I have a custom provider. I found this link after my posting and it seems to have solved the problem. http://stackoverflow.com/questions/1914437/asp-net-mvc-and-role-cachingIt seems silly to have a dedicated connection just to check roles, but it solved the problem.
Tom Schreck
Hi Tom - I ran into this same issue - do you just instantiate a new context at the the custom role provider?
morganpdx