L
Leo Selmani
Hello. I have a bit of a dilemma. I have implemented a forms authentication
for my application built in asp.net and it's working fine so far. I was
trying to create a menu based on roles. I put th emenu in a .master page so
it is available to all pages. I was planning to do the permissions check in
the master page and allow users to view menu items accordingly. However I am
running into an issue, that certain members of the security context are not
available: The most important is 'User'. It is available to all other pages,
but not .master page. For example:
if (User.IsInRole("Administrator"))
hlinkAdmin.Visible = true;
The above will work on Default.aspx page
It will not work in main.master page, because it says that 'User' does not
exist in current context. I am using all the necessary namespaces
Any ideas?
Thanks,
Leo
for my application built in asp.net and it's working fine so far. I was
trying to create a menu based on roles. I put th emenu in a .master page so
it is available to all pages. I was planning to do the permissions check in
the master page and allow users to view menu items accordingly. However I am
running into an issue, that certain members of the security context are not
available: The most important is 'User'. It is available to all other pages,
but not .master page. For example:
if (User.IsInRole("Administrator"))
hlinkAdmin.Visible = true;
The above will work on Default.aspx page
It will not work in main.master page, because it says that 'User' does not
exist in current context. I am using all the necessary namespaces
Any ideas?
Thanks,
Leo