WCSF Authorization

Topics: Web Client Software Factory
Mar 20, 2007 at 6:48 AM
Hello all,
I am trying to add a set of rules to a module. My problem is that i want to define multiple rules for 1 page, such as the code below
<rule Rule="Reader" Url="~/Module2/Default.aspx" />
<rule Rule="updater" Url="~/Module2/Default.aspx" />
<rule Rule="admin" Url="~/Module2/View1.aspx" />

The problem is that the composite web seems not to allow multiple rules for the same url, which is weird. Here in my example, when my config file is parsed, 2 rules are returned, the 2nd and the 3rd.

Anyone has a solution to this problem?

Thanks in advance.
Mar 20, 2007 at 9:25 PM
This a great question and I would also like to know the answer. I have just ran into this situation as well.
Mar 21, 2007 at 4:49 AM

Finally, I was able to solve this problem. The solotion lies in the AuthorizationRuleCollection class. Their is a method GetElementKey which returns the key for an element. This method returns the Url. So when the Collection is being built, all elements with duplicate keys are ignored.

What i did is to change the return value to the HashCode (GetHashCode) of the element instead of the Url, and it worked just fine.