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

Destination collection.

System.Stringkey

Key name.

System.Stringvalue

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
TypeNameDescription
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, Microsoft.Extensions.Primitives.StringValues>>source

Source collection.

System.StringheaderKey

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
TypeNameDescription
System.Linq.ILookup<System.String, System.String>source

Source collection.

System.StringheaderKey

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
TypeNameDescription
ISitecoreRenderingContextrenderingContext

Sitecore rendering context.

Microsoft.AspNetCore.Http.HttpContextcontext

Http context.

Do you have some feedback for us?

If you have suggestions for improving this article,