The asp menu control is in the master page. Its datasource is a web.sitemap file.
This file has all the items/Pages declared as nodes, initially. I have written this code to remove the items from the menu based on the user permissions, after user logs in.
protected void MyMenu_MenuItemDataBound(object sender, MenuEventArgs e)
//Code to remove items
protected void MyMenu_DataBound(object sender, EventArgs e)
The reason for the session variable is - The menuitemdatabound happens for every refresh/page request clicks, and I wanted the menu to be loaded only once for a user session.
PROBLEM: The 'Remove Item' code works fine. When the user logs in, the menu items do not show as desired. But when he clicks on an existing item to move to another page, All the menus appear again in the menubar.
Why is this happening. Should I allow the menu items to be bound everytime the page is refreshed or new url requested. its not right.is it?. But any other way around? or i could just remove the session condition.