caching question

Nov 9, 2011 at 1:02 AM
Edited Nov 9, 2011 at 1:15 AM

Hello:

I plan to use netsqlazman within a small .net web application as a role provider.

I created this very simple page:

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title>TestPage</title>
</head>
<body>
    <div>
   <% foreach(var x in new string[] {"costab", "costab1"}) { %>
       IsUserInRole("<%=x%>", "Role1")=<%= ((NetSqlAzMan.Providers.NetSqlAzManRoleProvider)Roles.Provider).IsUserInRole(x, "Role1")%><br/>
       <% } %>
       <%=Request.LogonUserIdentity.Name %><br />
       IsUserInRole("Role1") = <%=Roles.IsUserInRole("Role1") %>
    </div>
</body>
</html>

 

Let's say I start the web app, then I run the page. The user costab doesn't have Role1 yet. I use the netsqlazman console to assign costab to Role1. I re-run the page and IsUserInRole still returns false. This change doesn't seem to be effective in the app. I bounce the web server and I re-display the page. It now reports true for costab. Is this normal? How long does it take until changes in the security configuration become effective at runtime? Please note that I don't use the wcf caching service. Also, is there a way to control the caching, in case there is some caching going on even when the wcf caching service is not used? How about a scenario where I add costab to a group that was assigned Role1 already? Is that change effective immediately ?

 

I read some of the discussions that others have posted and you recommended the use of the caching service for a MVC web app. Don't the calls to the service add overhead to the app? Am I missing something?

Thank you

Coordinator
Nov 9, 2011 at 8:15 AM

Hi,

using the NetSqlAzMan WCF Cache Service is ever the best choise because performance.

However, to invalidate the cache, you can invoke the RoleProvider.InvalidateCache() method.

__________________________________
Andrea Ferendeles
NetSqlAzMan Project Coordinator
E-mail aferende@hotmail.com Web http://netsqlazman.codeplex.com