Class HttpContextExtensions
Version: 21.x
Extension methods to support the Microsoft.AspNetCore.Http.HttpContext.
Inheritance
System.Object
HttpContextExtensions
Namespace: Sitecore.AspNet.RenderingEngine
Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
RequestResponse
public static class HttpContextExtensions : ObjectMethods
GetSitecoreRenderingContext(HttpContext)
Gets the ISitecoreRenderingContext from the Microsoft.AspNetCore.Http.HttpContext.
Declaration
RequestResponse
public static ISitecoreRenderingContext GetSitecoreRenderingContext(this HttpContext context)Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.AspNetCore.Http.HttpContext | context |
The Microsoft.AspNetCore.Http.HttpContext instance to retrieve the Sitecore rendering context from. |
Returns
| Type | Description |
|---|---|
| ISitecoreRenderingContext |
The ISitecoreRenderingContext instance. |
SetSitecoreRenderingContext(HttpContext, ISitecoreRenderingContext)
Sets the ISitecoreRenderingContext in the current Microsoft.AspNetCore.Http.HttpContext.Features collection.
Declaration
RequestResponse
public static void SetSitecoreRenderingContext(this HttpContext context, ISitecoreRenderingContext renderingContext)Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.AspNetCore.Http.HttpContext | context |
The current Microsoft.AspNetCore.Http.HttpContext. |
| ISitecoreRenderingContext | renderingContext |
The ISitecoreRenderingContext to save in the feature collection. |