コード例 #1
0
        internal static WebPageBase CreateInstanceFromVirtualPath(string virtualPath, VirtualPathFactoryManager virtualPathFactoryManager)
        {
            // Get the compiled object (through the VPP)
            try {
                WebPageBase webPage = virtualPathFactoryManager.CreateInstance <WebPageBase>(virtualPath);

                // Give it its virtual path
                webPage.VirtualPath = virtualPath;

                return(webPage);
            }
            catch (HttpException e) {
                Util.ThrowIfUnsupportedExtension(virtualPath, e);
                throw;
            }
        }
コード例 #2
0
        internal static IHttpHandler CreateFromVirtualPath(string virtualPath, VirtualPathFactoryManager virtualPathFactoryManager)
        {
            // Instantiate the page from the virtual path
            object instance = virtualPathFactoryManager.CreateInstance <object>(virtualPath);

            WebPage page = instance as WebPage;

            // If it's not a page, assume it's a regular handler
            if (page == null)
            {
                return((IHttpHandler)instance);
            }

            // Mark it as a 'top level' page (as opposed to a user control or master)
            page.TopLevelPage = true;

            // Give it its virtual path
            page.VirtualPath = virtualPath;

            // Return a handler over it
            return(new WebPageHttpHandler(page));
        }