How to fill site menu via Cache?

Posted on 2011-02-17
Last Modified: 2013-12-17
i try to fill my menu with company stuff roles. Filling site map needs to many time.(4000ms) however; i filled site menu only one time in loading menu. like that:
NOT necessary to fill menu via cache . you can give me another advise to do it:)
    protected void Page_Load(object sender, EventArgs e)

            if (!IsPostBack)
                if (Session["IsPostBack"] == null)

                    SiteMapProvider sitemapProvider = (SiteMapProvider)Cache.Get("menu");
                    ASPxSiteMapDataSource1.Provider = sitemapProvider;
                    ASPxMenuMain.DataSource = ASPxSiteMapDataSource1;
  protected void FillMenu()
                SiteMapProvider sitemapProvider = GetSiteMapProvider(tempx);
                ASPxSiteMapDataSource1.Provider = sitemapProvider;
                ASPxMenuMain.DataSource = ASPxSiteMapDataSource1;
                Session["IsPostBack"] = "Postback";

    protected void FillFromCache(SiteMapProvider _provider)
            if (Cache["menu"] == null)
                Cache.Insert("menu", _provider);

Open in new window

Everything is ok on my local pc. After publishing my project, i see that our portal's menu don't show correct menu element.How can i solve it?
Question by:programmerist
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 18

Accepted Solution

Richard Lee earned 500 total points
ID: 34941769
Put the menu in a usercontrol and use outputcache to have the menu either cached by IIS server side or cache by the client and along the route.


Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In a recent question ( here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question