c# - Custom role provider cache troubleshooting -


I've written a custom role provider who uses web service methods to obtain roles or username internally This provider meets System.Web.Security.RoleProvider . The web.config file provides the caching feature I switched on the net that uses cookies.

How the web.config section looks for this provider:

  & lt; System.web & gt; & Lt; RoleManager defaultProvider = "MyProvider" enabled = "true" cacherroll INKUKI = "true" cookie name = ".Myrols" cookie timout = "30" cookiepath = "/" cookieRaviSL = "false" cookie sliding exposition = "true" cookie protection = "All" & gt; & Lt; Providers & gt; & Lt; Clear /> & Lt; Add name = "MYProvider" type = "MYProvider.MyRoleProvider, MYProvider" Service1URL = "http: // localhost: 54013 / service1.asmx" service2 URL = "http: // localhost: 54013 / service2.asmx" rolesPrefix = "ABC_" DomainName = "abc.corp" specialUserForAllRoles = "abc" applicationURL = "http://example.com" log Commommication = "true" /> & Lt; / Providers & gt; & Lt; / RoleManager & gt; & Lt; /system.web>  

Now, it comes to testing whether the cache is working or not. I've written a simple method that looks like this:

  public zero test cache () {string [] roles = roles GetAllRoles (); Roles = roles.gate all rolls (); String [] Roles ForUser1 = Roles GETRolesForUser ("user1"); Roles User 1 = Roles Petrolforce user ("user1"); String [] usersInRole = roles. GETUsersInRole ("ABC_DEV"); UsersInRole = Roles GETUsersInRole ("ABC_DEV"); Roles. ISUER Inroll ("User 1", "ABCDV"); Roles. ISUER Inroll ("User 1", "ABCDV"); }  

Debugging this piece of code (from the test web site), enters every method shown in the debugger provider and executes all the arguments from inside, despite it Whether or not it is unnecessary to include the facts. I think the second allocation of each method should not be executed because the results will be given to my provider without asking directly to the cash.

What am I thinking / doing wrong and how can I fix the caching facility?

Role cache only works for the current user's roles. It should be cached:

  var isInroll = User.IsInRole ("ABC_DEV")  


Comments