SenseNet.Portal.Page.ExecutePage C# (CSharp) 메소드

ExecutePage() 정적인 개인적인 메소드

static private ExecutePage ( HttpContext context, string virtualPath, PageBase page, Page pageNode, bool silent ) : void
context System.Web.HttpContext
virtualPath string
page PageBase
pageNode Page
silent bool
리턴 void
        static void ExecutePage(HttpContext context, string virtualPath, PageBase page, Page pageNode, bool silent)
        {
            Page originalCurrentPage = PortalContext.Current.Page;
            string originalPath = context.Request.Path;

            if (originalCurrentPage.Path == pageNode.Path)
                throw new InvalidOperationException("Executing a Page within itself is forbidden!");

            try
            {
                PortalContext.Current.Page = pageNode;
                context.RewritePath(virtualPath);
                context.Server.Execute(page, TextWriter.Null, false);
            }
            catch (Exception e)
            {
                if (!silent)
                    throw e;
                else
                    Logger.WriteException(e);
            }
            finally
            {
                context.RewritePath(originalPath);
                PortalContext.Current.Page = originalCurrentPage;
            }
        }