Exemplo n.º 1
0
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            if (!initialized)
            {
                lock (locker)
                {
                    if (!initialized)
                    {
                        initialized = true;

                        try
                        {
                            //Register cache
                            CacheManifest.AddServerFolder(new HttpContextWrapper(HttpContext.Current), "~/Content/images", "*.*");
                            CacheManifest.AddServerFolder(new HttpContextWrapper(HttpContext.Current), "~/Content/img", "*.*");
                            CacheManifest.AddServerFolder(new HttpContextWrapper(HttpContext.Current), "~/Content/sprite", "*.*");
                            CacheManifest.AddServerFile(new HttpContextWrapper(HttpContext.Current), "~/Scripts/libs/modernizr-1.7.min.js");
                            CacheManifest.AddCached(new Uri("/", UriKind.Relative));
                            CacheManifest.AddCached(new Uri("/Help/Authentication", UriKind.Relative));
                            CacheManifest.AddCached(new Uri("/Help/Faq", UriKind.Relative));
                            CacheManifest.AddCached(new Uri("/Help/Filters", UriKind.Relative));
                            CacheManifest.AddCached(new Uri("/Help/Batch", UriKind.Relative));
                            CacheManifest.AddOnline(new Uri("/Documentation/Search", UriKind.Relative));
                            CacheManifest.AddFallback(new Uri("/Documentation/Search", UriKind.Relative), new Uri("/docs/notfound", UriKind.Relative));

                            LogManager.GetLogger("ASC.Api").Debug("Generate documentations");
                            Documentation.Load(AppDomain.CurrentDomain.RelativeSearchPath, HttpContext.Current.Server.MapPath("~/App_Data/SearchIndex/"));
                            Documentation.GenerateRouteMap();
                        }
                        catch (Exception error)
                        {
                            LogManager.GetLogger("ASC.Api").Error(error);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            if (!initialized)
            {
                lock (locker)
                {
                    if (!initialized)
                    {
                        initialized = true;

                        try
                        {
                            //Register cache
                            CacheManifest.AddServerFolder(new HttpContextWrapper(HttpContext.Current), "~/content/img", "*.*");
                            CacheManifest.AddServerFile(new HttpContextWrapper(HttpContext.Current), "~/scripts/modernizr/modernizr-1.7.min.js");
                            CacheManifest.AddCached(new Uri("/", UriKind.Relative));
                            CacheManifest.AddCached(new Uri("/portals/basic", UriKind.Relative));
                            CacheManifest.AddCached(new Uri("/portals/auth", UriKind.Relative));
                            CacheManifest.AddCached(new Uri("/portals/faq", UriKind.Relative));
                            CacheManifest.AddCached(new Uri("/portals/filters", UriKind.Relative));
                            CacheManifest.AddCached(new Uri("/portals/batch", UriKind.Relative));
                            CacheManifest.AddOnline(new Uri("/portals/search", UriKind.Relative));
                            CacheManifest.AddFallback(new Uri("/portals/search", UriKind.Relative), new Uri("/portals/notfound", UriKind.Relative));

                            LogManager.GetLogger("ASC.Api").Debug("Generate documentations");
                            Documentation.Load(AppDomain.CurrentDomain.RelativeSearchPath);
                            Documentation.GenerateRouteMap("portals");
                        }
                        catch (Exception error)
                        {
                            LogManager.GetLogger("ASC.Api").Error(error);
                        }
                    }
                }
            }
        }