Class HttpContextExtensions

Version: 21.x

Http context extensions.

Inheritance

System.Object

HttpContextExtensions

Namespace: Sitecore.AspNet.RenderingEngine.Extensions

Assembly: Sitecore.AspNet.RenderingEngine.dll

Syntax
public static class HttpContextExtensions : Object

Methods

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
public static void AppendValue(this IDictionary<string, string[]> collection, string key, string value)
Parameters
TypeNameDescription
System.Collections.Generic.IDictionary

<

System.String

,

System.String

[]>
collectionDestination collection.
System.StringkeyKey name.
System.StringvalueValue to be added to values array.

CopyHeader(IEnumerable<KeyValuePair<String, StringValues>>, String, IDictionary<String, String[]>)

Extension method for copying of Http headers.

Declaration
public static void CopyHeader(this IEnumerable<KeyValuePair<string, StringValues>> source, string headerKey, IDictionary<string, string[]> destination)
Parameters
TypeNameDescription
System.Collections.Generic.IEnumerable

<

System.Collections.Generic.KeyValuePair

<

System.String

,

Microsoft.Extensions.Primitives.StringValues

>>
sourceSource collection.
System.StringheaderKeyHeader name to copy.
System.Collections.Generic.IDictionary

<

System.String

,

System.String

[]>
destinationDestination collection.

CopyHeader(ILookup<String, String>, String, IDictionary<String, String[]>)

Extension method for copying of Http headers.

Declaration
public static void CopyHeader(this ILookup<string, string> source, string headerKey, IDictionary<string, string[]> destination)
Parameters
TypeNameDescription
System.Linq.ILookup

<

System.String

,

System.String

>
sourceSource collection.
System.StringheaderKeyHeader name to copy.
System.Collections.Generic.IDictionary

<

System.String

,

System.String

[]>
destinationDestination collection.

UpdateResponseWithLayoutMetadata(ISitecoreRenderingContext, HttpContext)

Updates response with meta data from sitecore rendering context.

Declaration
public static void UpdateResponseWithLayoutMetadata(this ISitecoreRenderingContext renderingContext, HttpContext context)
Parameters
TypeNameDescription
ISitecoreRenderingContextrenderingContextSitecore rendering context.
Microsoft.AspNetCore.Http.HttpContextcontextHttp context.
If you have suggestions for improving this article, let us know!