Try our conversational search powered by Generative AI!

Class HttpContextExtensions

Convenient methods to get information around current http request

Inheritance
System.Object
HttpContextExtensions
Namespace: EPiServer.Web.Routing
Assembly: EPiServer.Cms.AspNetCore.dll
Version: 12.0.3
Syntax
public static class HttpContextExtensions : Object

Methods

Gets a reference to the current routed content instance.

Declaration
public static ContentReference GetContentLink(this HttpContext httpContext)
Parameters
Type Name Description
Microsoft.AspNetCore.Http.HttpContext httpContext

The http context.

Returns
Type Description
ContentReference

A reference to current routed content or null if request is not routed to content

GetRequestedLanguage(HttpContext)

Gets the content language that current request was determined to

Declaration
public static string GetRequestedLanguage(this HttpContext httpContext)
Parameters
Type Name Description
Microsoft.AspNetCore.Http.HttpContext httpContext

The http context.

Returns
Type Description
System.String

The content language that current request was determined for or null if current request was not routed for any language