Class Context
- Namespace
- Dynamicweb
- Assembly
- Dynamicweb.Core.dll
Encapsulates all context specific information about an individual Request
public static class Context
- Inheritance
-
Context
- Inherited Members
Properties
ContextAccessor
The context accessor
public static IContextAccessor? ContextAccessor { get; set; }
Property Value
Current
Gets or sets the current context
public static IContext? Current { get; set; }
Property Value
- IContext
The current context.
Methods
CreateContext(ContextSettings)
Creates a background context using the specified URL.
public static IContext CreateContext(ContextSettings settings)
Parameters
settingsContextSettingsThe URL to create the message context for.
Returns
- IContext
The created message context.
Examples
if (Context.Current is null && absoluteUrl is not null)
Context.Current = Context.CreateContext(new ContextSettings() { Url = new Uri("https://www.example.com") });
Remarks
Creates a IContext object that represents a background context using the specified URL. This context can be used in scenarios where Context.Current is null, for example when sending emails or running in background threads. The passed URI should be an absolute URL to the site, for example "http://www.example.com".