Using Session variable in Layer rule

Topics: Customizing Orchard, General
Mar 23, 2013 at 4:27 PM
Hi All,

Is it possible to use Session variable in layer rule definition? If yes, could you please let me know how?

Thanks in advance,
Mar 24, 2013 at 5:47 AM
Sure, implement your own layer rule provider. You can look at the existing rules, such as the url rule, as an example.
Mar 24, 2013 at 3:31 PM
Thanks BertrandLeRoy.

Could you give me little more hint on how to implement a custom layer rule provider?

I am sorry if asking a very basic question, have just started evaluating Orchard.

Mar 24, 2013 at 8:37 PM
The best hint right now is as Bertrand suggested, by looking at the existing rules such as the UrlRuleProvider in Orchard.Widgets.
You can get to the Session by injecting IWorkContextAccessor (or IOrchardServices which itself has a reference to the current WorkContext).
Mar 25, 2013 at 4:32 AM
Thanks SfmSkywalker,

I will take a detail look at it.