Try our conversational search powered by Generative AI!

Render page properties in xml

Vote:
 

Hi all,

I am looking to render the contents/properties of a page in xml as opposed to using the pagetype's associated template - if a parameter was present in the querystring.

I was thinking of writing a httphandler to do this but it seems it would be difficult to get access to the requested page's PageData (in the 'ProcessRequest' method).

Is there some way of achieving this? - if so any help would be much appreciated.

Thank You

#50448
May 02, 2011 18:03
Vote:
 

Hi

I'd loop over the PageData.Property.

            foreach(PropertyData objData in CurrentPage.Property)
{
var x = objData.Name;
var y = objData.Value;
}

 

Edit:

I see now that you might want to get the PageData object. Check the SDK for DataFactory.GetPage()

#50449
Edited, May 02, 2011 20:05
Vote:
 

One easy way is to change the master page by overrirde the OnPreInit

protected override void OnPreInit(EventArgs e)
{
            if(Request["404"]!=null)
            {
                MasterPageFile = "/Custom/MasterPages/PageNotFound.master";
            }

    }

Then you can easy use the code Hernrik posted.

 

 

#50452
May 03, 2011 8:28
Vote:
 

You could create a PagePlugIn and hook the PageBase.PageSetup event and then attach your code to every page request.

Check out Allan Thraens blogpost on how he does much the same thing, though rendering to PDF, but the same principle
would apply: http://labs.episerver.com/en/Blogs/Allan/Dates/112230/7/Output-EPiServer-Pages-as-PDF/

/johan

#50453
May 03, 2011 8:58
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.