Class HttpContextExtensions
Version: 21.x
Http context extensions.
Inheritance
System.Object
HttpContextExtensions
Namespace: Sitecore.AspNet.RenderingEngine.Extensions
Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
RequestResponse
public static class HttpContextExtensions : ObjectMethods
AppendValue(IDictionary<String, String[]>, String, String)
Extension method for collection manipulation simplifications. It insert/appends string value to dictinary item. Is usefull for headers manipulations.
Declaration
RequestResponse
public static void AppendValue(this IDictionary<string, string[]> collection, string key, string value)Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IDictionary<System.String, System.String[]> | collection |
Destination collection. |
| System.String | key |
Key name. |
| System.String | value |
Value to be added to values array. |
CopyHeader(IEnumerable<KeyValuePair<String, StringValues>>, String, IDictionary<String, String[]>)
Extension method for copying of Http headers.
Declaration
RequestResponse
public static void CopyHeader(this IEnumerable<KeyValuePair<string, StringValues>> source, string headerKey, IDictionary<string, string[]> destination)Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, Microsoft.Extensions.Primitives.StringValues>> | source |
Source collection. |
| System.String | headerKey |
Header name to copy. |
| System.Collections.Generic.IDictionary<System.String, System.String[]> | destination |
Destination collection. |
CopyHeader(ILookup<String, String>, String, IDictionary<String, String[]>)
Extension method for copying of Http headers.
Declaration
RequestResponse
public static void CopyHeader(this ILookup<string, string> source, string headerKey, IDictionary<string, string[]> destination)Parameters
| Type | Name | Description |
|---|---|---|
| System.Linq.ILookup<System.String, System.String> | source |
Source collection. |
| System.String | headerKey |
Header name to copy. |
| System.Collections.Generic.IDictionary<System.String, System.String[]> | destination |
Destination collection. |
UpdateResponseWithLayoutMetadata(ISitecoreRenderingContext, HttpContext)
Updates response with meta data from sitecore rendering context.
Declaration
RequestResponse
public static void UpdateResponseWithLayoutMetadata(this ISitecoreRenderingContext renderingContext, HttpContext context)Parameters
| Type | Name | Description |
|---|---|---|
| ISitecoreRenderingContext | renderingContext |
Sitecore rendering context. |
| Microsoft.AspNetCore.Http.HttpContext | context |
Http context. |