Search Results for

    Show / Hide Table of Contents
    View Source

    Class PublishedRequest

    Represents a request for one specified Umbraco IPublishedContent to be rendered by one specified template, using one specified Culture and RenderingEngine.

    Inheritance
    System.Object
    Namespace: Umbraco.Web.Routing
    Assembly: Umbraco.Web.dll
    Syntax
    public class PublishedRequest

    Properties

    View Source

    Cacheability

    Gets or sets the System.Web.HttpCacheability

    Declaration
    public HttpCacheability Cacheability { get; set; }
    Property Value
    Type Description
    System.Web.HttpCacheability
    View Source

    CacheExtensions

    Gets or sets a list of Extensions to append to the Response.Cache object.

    Declaration
    public List<string> CacheExtensions { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>
    View Source

    Culture

    Gets or sets the content request's culture.

    Declaration
    public CultureInfo Culture { get; set; }
    Property Value
    Type Description
    System.Globalization.CultureInfo
    View Source

    Domain

    Gets or sets the content request's domain.

    Declaration
    public DomainAndUri Domain { get; set; }
    Property Value
    Type Description
    DomainAndUri
    Remarks

    Is a DomainAndUri object ie a standard Domain plus the fully qualified uri. For example, the Domain may contain "example.com" whereas the Uri will be fully qualified eg "http://example.com/";.

    View Source

    HasDomain

    Gets a value indicating whether the content request has a domain.

    Declaration
    public bool HasDomain { get; }
    Property Value
    Type Description
    System.Boolean
    View Source

    HasPublishedContent

    Gets a value indicating whether the content request has a content.

    Declaration
    public bool HasPublishedContent { get; }
    Property Value
    Type Description
    System.Boolean
    View Source

    HasTemplate

    Gets a value indicating whether the content request has a template.

    Declaration
    public bool HasTemplate { get; }
    Property Value
    Type Description
    System.Boolean
    View Source

    Headers

    Gets or sets a dictionary of Headers to append to the Response object.

    Declaration
    public Dictionary<string, string> Headers { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.String>
    View Source

    IgnorePublishedContentCollisions

    Gets or sets a value indicating whether the Umbraco Backoffice should ignore a collision for this request.

    Declaration
    public bool IgnorePublishedContentCollisions { get; set; }
    Property Value
    Type Description
    System.Boolean
    View Source

    InitialPublishedContent

    Gets the initial requested content.

    Declaration
    public IPublishedContent InitialPublishedContent { get; }
    Property Value
    Type Description
    IPublishedContent
    Remarks

    The initial requested content is the content that was found by the finders, before anything such as 404, redirect... took place.

    View Source

    Is404

    Gets or sets a value indicating whether the requested content could not be found.

    Declaration
    public bool Is404 { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    This is set in the PublishedContentRequestBuilder and can also be used in custom content finders or Prepared event handlers, where we want to allow developers to indicate a request is 404 but not to cancel it.

    View Source

    IsInitialPublishedContent

    Gets value indicating whether the current published content is the initial one.

    Declaration
    public bool IsInitialPublishedContent { get; }
    Property Value
    Type Description
    System.Boolean
    View Source

    IsInternalRedirectPublishedContent

    Gets or sets a value indicating whether the current published content has been obtained from the initial published content following internal redirections exclusively.

    Declaration
    public bool IsInternalRedirectPublishedContent { get; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    Used by PublishedContentRequestEngine.FindTemplate() to figure out whether to apply the internal redirect or not, when content is not the initial content.

    View Source

    IsRedirect

    Gets a value indicating whether the content request triggers a redirect (permanent or not).

    Declaration
    public bool IsRedirect { get; }
    Property Value
    Type Description
    System.Boolean
    View Source

    IsRedirectPermanent

    Gets or sets a value indicating whether the redirect is permanent.

    Declaration
    public bool IsRedirectPermanent { get; }
    Property Value
    Type Description
    System.Boolean
    View Source

    PublishedContent

    Gets or sets the requested content.

    Declaration
    public IPublishedContent PublishedContent { get; set; }
    Property Value
    Type Description
    IPublishedContent
    Remarks

    Setting the requested content clears Template.

    View Source

    RedirectUrl

    Gets or sets the URL to redirect to, when the content request triggers a redirect.

    Declaration
    public string RedirectUrl { get; }
    Property Value
    Type Description
    System.String
    View Source

    ResponseStatusCode

    Gets or sets the content request http response status code.

    Declaration
    public int ResponseStatusCode { get; }
    Property Value
    Type Description
    System.Int32
    Remarks

    Does not actually set the http response status code, only registers that the response should use the specified code. The code will or will not be used, in due time.

    View Source

    ResponseStatusDescription

    Gets or sets the content request http response status description.

    Declaration
    public string ResponseStatusDescription { get; }
    Property Value
    Type Description
    System.String
    Remarks

    Does not actually set the http response status description, only registers that the response should use the specified description. The description will or will not be used, in due time.

    View Source

    TemplateAlias

    Gets the alias of the template to use to display the requested content.

    Declaration
    public string TemplateAlias { get; }
    Property Value
    Type Description
    System.String
    View Source

    UmbracoContext

    Gets the UmbracoContext.

    Declaration
    public UmbracoContext UmbracoContext { get; }
    Property Value
    Type Description
    UmbracoContext
    View Source

    Uri

    Gets or sets the cleaned up Uri used for routing.

    Declaration
    public Uri Uri { get; set; }
    Property Value
    Type Description
    System.Uri
    Remarks

    The cleaned up Uri has no virtual directory, no trailing slash, no .aspx extension, etc.

    Methods

    View Source

    Prepare()

    Prepares the request.

    Declaration
    public void Prepare()
    View Source

    ResetTemplate()

    Resets the template.

    Declaration
    public void ResetTemplate()
    View Source

    SetInternalRedirectPublishedContent(IPublishedContent)

    Sets the requested content, following an internal redirect.

    Declaration
    public void SetInternalRedirectPublishedContent(IPublishedContent content)
    Parameters
    Type Name Description
    IPublishedContent content

    The requested content.

    Remarks

    Depending on UmbracoSettings.InternalRedirectPreservesTemplate, will preserve or reset the template, if any.

    View Source

    SetIsInitialPublishedContent()

    Indicates that the current PublishedContent is the initial one.

    Declaration
    public void SetIsInitialPublishedContent()
    View Source

    SetRedirect(String)

    Indicates that the content request should trigger a redirect (302).

    Declaration
    public void SetRedirect(string url)
    Parameters
    Type Name Description
    System.String url

    The URL to redirect to.

    Remarks

    Does not actually perform a redirect, only registers that the response should redirect. Redirect will or will not take place in due time.

    View Source

    SetRedirect(String, Int32)

    Indicates that the content request should trigger a redirect, with a specified status code.

    Declaration
    public void SetRedirect(string url, int status)
    Parameters
    Type Name Description
    System.String url

    The URL to redirect to.

    System.Int32 status

    The status code (300-308).

    Remarks

    Does not actually perform a redirect, only registers that the response should redirect. Redirect will or will not take place in due time.

    View Source

    SetRedirectPermanent(String)

    Indicates that the content request should trigger a permanent redirect (301).

    Declaration
    public void SetRedirectPermanent(string url)
    Parameters
    Type Name Description
    System.String url

    The URL to redirect to.

    Remarks

    Does not actually perform a redirect, only registers that the response should redirect. Redirect will or will not take place in due time.

    View Source

    SetResponseStatus(Int32, String)

    Sets the http response status code, along with an optional associated description.

    Declaration
    public void SetResponseStatus(int code, string description = null)
    Parameters
    Type Name Description
    System.Int32 code

    The http status code.

    System.String description

    The description.

    Remarks

    Does not actually set the http response status code and description, only registers that the response should use the specified code and description. The code and description will or will not be used, in due time.

    View Source

    SetTemplate(ITemplate)

    Sets the template to use to display the requested content.

    Declaration
    public void SetTemplate(ITemplate template)
    Parameters
    Type Name Description
    ITemplate template

    The template.

    Remarks

    Setting the template does refresh RenderingEngine.

    View Source

    TrySetTemplate(String)

    Tries to set the template to use to display the requested content.

    Declaration
    public bool TrySetTemplate(string alias)
    Parameters
    Type Name Description
    System.String alias

    The alias of the template.

    Returns
    Type Description
    System.Boolean

    A value indicating whether a valid template with the specified alias was found.

    Remarks

    Successfully setting the template does refresh RenderingEngine.

    If setting the template fails, then the previous template (if any) remains in place.

    Events

    View Source

    Prepared

    Triggers once the published content request has been prepared, but before it is processed.

    Declaration
    public static event EventHandler<EventArgs> Prepared
    Event Type
    Type Description
    System.EventHandler<System.EventArgs>
    Remarks

    When the event triggers, preparation is done ie domain, culture, document, template, rendering engine, etc. have been setup. It is then possible to change anything, before the request is actually processed and rendered by Umbraco.

    View Source

    Preparing

    Triggers before the published content request is prepared.

    Declaration
    public static event EventHandler<EventArgs> Preparing
    Event Type
    Type Description
    System.EventHandler<System.EventArgs>
    Remarks

    When the event triggers, no preparation has been done. It is still possible to modify the request's Uri property, for example to restore its original, public-facing value that might have been modified by an in-between equipment such as a load-balancer.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX