public IAspect[] CreateAspects(WebPageContext context)
        {
            IWebPageLocator locator = WebPageLocatorFactory.CreateLocator(context.PathExtension);
            var             aspects = locator.GetAspects(context.VirtualPath);

            if (aspects == null)
            {
                if (!context.IsValidPath())
                {
                    //如果既没有后台文件,也没有前台文件,那么资源不存在
                    throw new HttpException(404, string.Format(Strings.RequestResourceNotExist, context.VirtualPath));
                }
                aspects = locator.GetDefaultAspects(); //如果有前台文件那么用默认的处理
            }
            return(aspects);
        }
        private static WebPage CreatePage(WebPageContext context)
        {
            IWebPageLocator locator = WebPageLocatorFactory.CreateLocator(context.PathExtension);
            IHttpHandler    handler = locator.GetHandler(context.VirtualPath);//利用资源定位器得到资源的Handler类型

            if (handler == null)
            {
                if (!context.IsValidPath())
                {
                    //如果既没有后台文件,也没有前台文件,那么资源不存在
                    throw new HttpException(404, string.Format(Strings.RequestResourceNotExist, context.VirtualPath));
                }
                handler = locator.GetDefaultHandler(); //如果有前台文件那么用默认的处理
            }
            WebPage page = handler as WebPage;

            if (page == null)
            {
                throw new TypeMismatchException(handler.GetType(), typeof(WebPage));
            }
            return(page);
        }