Class HttpContextExtensions

Extension methods for System.Web.HttpContext.

Inheritance
System.Object
HttpContextExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
public static class HttpContextExtensions

Methods

ContextBaseOrNull(HttpContext)

Extension method that wraps System.Web.HttpContext in a System.Web.HttpContextWrapper or returns null if httpContext is null.

Declaration
public static HttpContextBase ContextBaseOrNull(this HttpContext httpContext)
Parameters
Type Name Description
System.Web.HttpContext httpContext

The HTTP context.

Returns
Type Description
System.Web.HttpContextBase

HostName(HttpRequestBase)

Attempts to get the hostname that was requested, either from the headers or the URL of the current request.

Declaration
public static string HostName(this HttpRequestBase request)
Parameters
Type Name Description
System.Web.HttpRequestBase request

The request to extract the hostname from.

Returns
Type Description
System.String

The hostname as extracted from the request or null if not found or if the request is null.

RequestBaseOrNull(HttpContext)

Extension method that wraps System.Web.HttpContext.Request object in a System.Web.HttpRequestWrapper or returns null if httpContext is null.

Declaration
public static HttpRequestBase RequestBaseOrNull(this HttpContext httpContext)
Parameters
Type Name Description
System.Web.HttpContext httpContext

The HTTP context.

Returns
Type Description
System.Web.HttpRequestBase