Unosquare
    Show / Hide Table of Contents

    Class CorsModule

    Cross-origin resource sharing (CORS) control Module. CORS is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the resource originated.

    Inheritance
    Object
    WebModuleBase
    CorsModule
    Implements
    IWebModuleImpl
    IWebModule
    Inherited Members
    WebModuleBase.Container
    WebModuleBase.IWebModuleImpl.SetContainer(IWebModuleContainer)
    WebModuleBase.BaseRoute
    WebModuleBase.OnUnhandledException
    WebModuleBase.OnHttpException
    WebModuleBase.LogSource
    WebModuleBase.Start(CancellationToken)
    WebModuleBase.MatchUrlPath(String)
    WebModuleBase.HandleRequestAsync(IHttpContext)
    WebModuleBase.OnStart(CancellationToken)
    WebModuleBase.SetContainer(IWebModuleContainer)
    Namespace: EmbedIO.Cors
    Syntax
    public class CorsModule : WebModuleBase, IWebModuleImpl, IWebModule

    Constructors

    CorsModule(String, String, String, String)

    Initializes a new instance of the CorsModule class.

    Declaration
    public CorsModule(string baseRoute, string origins = "*", string headers = "*", string methods = "*")
    Parameters
    Type Name Description
    String baseRoute

    The base route.

    String origins

    The valid origins. The default is All (*).

    String headers

    The valid headers. The default is All (*).

    String methods

    The valid methods. The default is All (*).

    Fields

    All

    A string meaning "All" in CORS headers.

    Declaration
    public const string All = "*"
    Field Value
    Type Description
    String

    Properties

    IsFinalHandler

    Gets a value indicating whether processing of a request should stop after a module has handled it.

    Declaration
    public override bool IsFinalHandler { get; }
    Property Value
    Type Description
    Boolean
    Overrides
    WebModuleBase.IsFinalHandler
    Remarks

    If this property is true, a HTTP context's SetHandled() method will be automatically called immediately after after the returned by HandleRequestAsync(IHttpContext) is completed. This will prevent the context from being passed further along to other modules.

    See Also
    IsHandled
    SetHandled()

    Methods

    OnRequestAsync(IHttpContext)

    Called to handle a request from a client.

    Declaration
    protected override Task OnRequestAsync(IHttpContext context)
    Parameters
    Type Name Description
    IHttpContext context

    The context of the request being handled.

    Returns
    Type Description
    Task

    A representing the ongoing operation.

    Overrides
    WebModuleBase.OnRequestAsync(IHttpContext)

    Implements

    IWebModuleImpl
    IWebModule

    Comments

    Back to top Copyright © 2017-2019 Unosquare