Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello everyone... I tryed something like (but obviously failed):
<% var hasRole = (System.Web.Security.Roles.GetRolesForUser().Any(item => item == "<umbraco:item field='PageName' runat='server'></umbraco:item>" )); %>
but when the server code is executed the umbraco:item is not rendered, so I was wondering if there is some other way to get the item value before render
I was wondering about doing something like...
<% var hasRole = (System.Web.Security.Roles.GetRolesForUser().Any(item => item == Umbraco.GetItemValue("PageName") )); %>
Here I found a workaround but is not I was expecting
<% var pageName = this.Request.RawUrl.Replace(".aspx", "").Replace("/","");
var hasRole = (System.Web.Security.Roles.GetRolesForUser().Any(item => item == pageName )); %>
Hi,
Could you explain what you're trying to achieve? There might be an easier way to accomplish what you're after.
Looking forward to your info.
Cheers,
/Dirk
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Problem with umbraco:item and server code (umbraco:item is not rendered when server code is executed)
Hello everyone... I tryed something like (but obviously failed):
<% var hasRole = (System.Web.Security.Roles.GetRolesForUser().Any(item => item == "<umbraco:item field='PageName' runat='server'></umbraco:item>" )); %>
but when the server code is executed the umbraco:item is not rendered, so I was wondering if there is some other way to get the item value before render
I was wondering about doing something like...
<% var hasRole = (System.Web.Security.Roles.GetRolesForUser().Any(item => item == Umbraco.GetItemValue("PageName") )); %>
Here I found a workaround but is not I was expecting
<% var pageName = this.Request.RawUrl.Replace(".aspx", "").Replace("/","");
var hasRole = (System.Web.Security.Roles.GetRolesForUser().Any(item => item == pageName )); %>
Hi,
Could you explain what you're trying to achieve? There might be an easier way to accomplish what you're after.
Looking forward to your info.
Cheers,
/Dirk
is working on a reply...