---
title: "Class HttpContextExtensions"
slug: "sitecore.aspnet.renderingengine.extensions.httpcontextextensions"
abstract: ""
---
# Class HttpContextExtensions

Http context extensions.

## Inheritance

System.Object

HttpContextExtensions

### **Namespace**: Sitecore.AspNet.RenderingEngine.Extensions

#### **Assembly**: Sitecore.AspNet.RenderingEngine.dll

##### Syntax

```csharp
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

```csharp
public static void AppendValue(this IDictionary<string, string[]> collection, string key, string value)

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| System.Collections.Generic.IDictionary<br><br><<br><br>System.String<br><br>,<br><br>System.String<br><br>[]> | 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

```csharp
public static void CopyHeader(this IEnumerable<KeyValuePair<string, StringValues>> source, string headerKey, IDictionary<string, string[]> destination)

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| System.Collections.Generic.IEnumerable<br><br><<br><br>System.Collections.Generic.KeyValuePair<br><br><<br><br>System.String<br><br>,<br><br>Microsoft.Extensions.Primitives.StringValues<br><br>>> | source | Source collection. |
| System.String | headerKey | Header name to copy. |
| System.Collections.Generic.IDictionary<br><br><<br><br>System.String<br><br>,<br><br>System.String<br><br>[]> | destination | Destination collection. |

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

Extension method for copying of Http headers.

##### Declaration

```csharp
public static void CopyHeader(this ILookup<string, string> source, string headerKey, IDictionary<string, string[]> destination)

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| System.Linq.ILookup<br><br><<br><br>System.String<br><br>,<br><br>System.String<br><br>> | source | Source collection. |
| System.String | headerKey | Header name to copy. |
| System.Collections.Generic.IDictionary<br><br><<br><br>System.String<br><br>,<br><br>System.String<br><br>[]> | destination | Destination collection. |

#### UpdateResponseWithLayoutMetadata(ISitecoreRenderingContext, HttpContext)

Updates response with meta data from sitecore rendering context.

##### Declaration

```csharp
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. |
