I have a complex XSLT file that I do not want to have to re-write into a usercontrol so I am hoping that there is some way I can do this in XSLT. I am using a custom membership provider and I need to check whether a user is in a specific role in my XSLT. I found an article that showed me how to run some c# code in my XSLT to find a key from a web.config file. I have tried to apply the same logic to see if a user is in a role but I get an error when saving the XSLT file. Can anyone help with this? The script I have so far is:
The first part (getWebConfigKey) works fine but I get an error when trying to save my XSLT after adding the "subscriber" code:
Error occured
Error in XSLT at line 348, char 17 346: public bool subscriber(string role) 347: { 348: >>> if (System.Web.HttpContext.Current.User.IsInRole(role)) <<< 349: { 350: return true;
Does anyone have any suggestions on this one? Or know if it is even possible? Or does anyone know a way in just XSLT I can check the role of a user with having to use "System.Web.HttpContext.Current.User.IsInRole(role)"
Check user role using XSLT and c#
Hi All,
I have a complex XSLT file that I do not want to have to re-write into a usercontrol so I am hoping that there is some way I can do this in XSLT. I am using a custom membership provider and I need to check whether a user is in a specific role in my XSLT. I found an article that showed me how to run some c# code in my XSLT to find a key from a web.config file. I have tried to apply the same logic to see if a user is in a role but I get an error when saving the XSLT file. Can anyone help with this? The script I have so far is:
The first part (getWebConfigKey) works fine but I get an error when trying to save my XSLT after adding the "subscriber" code:
Error occured
Error in XSLT at line 348, char 17
346: public bool subscriber(string role)
347: {
348: >>> if (System.Web.HttpContext.Current.User.IsInRole(role)) <<<
349: {
350: return true;
Does anyone have any suggestions on this one? Or know if it is even possible? Or does anyone know a way in just XSLT I can check the role of a user with having to use "System.Web.HttpContext.Current.User.IsInRole(role)"
Regards
Tony
is working on a reply...