Solved

How to fill site menu via Cache?

Posted on 2011-02-17
1
365 Views
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)
                {
                    FillMenu();
                }
                else
                {

                    SiteMapProvider sitemapProvider = (SiteMapProvider)Cache.Get("menu");
                    ASPxSiteMapDataSource1.Dispose();
                    ASPxSiteMapDataSource1.Provider = sitemapProvider;
                    ASPxSiteMapDataSource1.DataBind();
                    ASPxMenuMain.Dispose();
                    ASPxMenuMain.DataSource = ASPxSiteMapDataSource1;
                    ASPxMenuMain.DataBind();
                }
  protected void FillMenu()
        {
                SiteMapProvider sitemapProvider = GetSiteMapProvider(tempx);
                ASPxSiteMapDataSource1.Provider = sitemapProvider;
                ASPxSiteMapDataSource1.DataBind();
                ASPxMenuMain.DataSource = ASPxSiteMapDataSource1;
                ASPxMenuMain.DataBind();
                FillFromCache(sitemapProvider);
                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 asp.net project, i see that our portal's menu don't show correct menu element.How can i solve it?
0
Comment
Question by:programmerist
[X]
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

by:
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.

http://support.microsoft.com/kb/308375

DaTribe
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

734 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