Hi,
There are two scenarios that you might be confused about:
1. User navigating from PageA.aspx to PageB.aspx. In this case even both PageA.aspx and PageB.aspx uses the same master page MasterPage.master, the menu
will need to be repopulated. This is the normal behavior;
2. User working within PageA.aspx. For example, you have a button inside PageA.aspx, user clicks it, the page goes back to the server, updates something and reloads. In this case, the menu automatically saves all items inside view state until you explicitly repopulate it unless ViewState is disabled. Usually people do this inside Page_Load to avoid repopulating during postback:
Code: C#
If (!Page.IsPostBack)
PopulateMenu();
The key at here is as soon as a page is rendered, everything exception for cookies and sessions is gone (the key for a Web server to serve many users at the same time is that it does not keep much information in memory at all). So there is no such thing as automatically carrying control state information from PageA.aspx to PageB.aspx unless you explicitly code for it. ASP.NET retains state information within the same page with ViewState, but that only occurs when PageA.aspx goes back to PageA.aspx. When PageA.aspx goes to PageB.aspx, everything in PageA is discarded. It's the server's responsiblity to reconstruct everything from ground up based on certain informations (for example, the current loged in user ID).
Thus in your case it is quite normal that the menu is being repopulated every time. For example when you populate inside the login event, it will be discarded when the page redirects to another page. This is how it supposes to work.
There are two things you can do:
1. If you are not already using "if (!Page.IsPostBack)", you can add that so that the menu will only be populated once when a page initially load but not during postback;
2. After you get your menu data from your database, saves it inside your Session object. Later on you will still need to populate the menu every time, but instead of getting the data again from the database, you get it directly from Session object. This reduces your database server's load, but increases your Web server's memory consumption. Obviously if you use SQL Server to store session data, then this will be completely pointless;
Hope this helps. Please let us know if you still have more questions.
Thanks!