Retrieving a Page Ingeniux DSS Library

Retrieving a page with the DSS API

Retrieving a Page by Request

With the DSS, you don't have to worry about much details to get started. Directly calling the GetPage method and passing in the Request object will do the trick.

This returns an ICMSRoutingRequest object, which contains both the page request and the remaining path. The remaing path can be used to hook up additional routes that go beyond a CMS page but use the CMS page path as the base path.

C#
ICMSRoutingRequest routingRequest = pageFactory.GetPage(Request); //directly pass in the Context.Request object
ICMSRequest cmsRequest = routingRequest.CMSRequest; //ICMSRequest is returned

The returned request can be for redirection only, or it can contain an actual page. Use the following code in either scenario:

C#
  ...
if (cmsRequest is CMSPageRedirectRequest)
{
    //performs redirect if URL is not canonical
    Response.RedirectPermanent(
        VirtualPathUtility.ToAbsolute("~" + (cmsRequest as CMSPageRedirectRequest).FinalUrl));
}
else if (cmsRequest is ICMSPage)
{
    //gets the actual page object
    ICMSPage pageRequest = cmsRequest as ICMSPage;
    ...
}

ICMSPageFactory uses the Structured URL Map to determine if a Page exists; if a URL is for redirection; and the page for which to return data.

Retrieving a Page by xID

If an xID is available, you can retrieve a Page with it. This always returns an actual ICMSPage object.

C#
ICMSRequest cmsRequest = pageFactory.GetPage(Request, "x25");
See Also

Reference