コード例 #1
0
        public static string GetDisplayPage(HttpApplication app, string objectType, string objectId)
        {
            // LOOK FOR PAGE LOOKUP IN APPLICATION CACHE
            StringDictionary pageLookup  = RewriteUrlLookupEngine.GetLookupTable(app);
            string           displayPage = pageLookup[(objectType + objectId)];

            if (((displayPage == null) ||
                 (displayPage.Length == 0)))
            {
                displayPage = pageLookup[objectType];
                if (((displayPage == null) ||
                     (displayPage.Length == 0)))
                {
                    switch (objectType)
                    {
                    case "C":
                        displayPage = "category";
                        break;

                    case "P":
                        displayPage = "product1";
                        break;

                    case "W":
                        displayPage = "webpage";
                        break;

                    default:
                        displayPage = ("unknowntype_" + objectType);
                        break;
                    }
                }
            }
            return(displayPage);
        }
コード例 #2
0
        public static StringDictionary GetLookupTable(HttpApplication app)
        {
            // LOOK FOR PAGE LOOKUP IN APPLICATION CACHE
            app.Context.Trace.Write(typeof(RewriteUrlLookupEngine).ToString(), "Load lookup table from cache.");
            StringDictionary pageLookup = (StringDictionary)app.Context.Cache["AbleRewrite_PageLookup"];

            if ((pageLookup == null))
            {
                app.Context.Trace.Warn(typeof(RewriteUrlLookupEngine).ToString(), "Generate new lookup table.");
                pageLookup = RewriteUrlLookupEngine.GenerateLookupTable(app);
                app.Context.Cache["AbleRewrite_PageLookup"] = pageLookup;
            }
            return(pageLookup);
        }