Share via


PortalApplication.GetContext Method (HttpContext)

Gets a reference to a PortalContext object that represents the current application context from the specified HttpContext object.

Namespace:  Microsoft.SharePoint.Portal
Assembly:  Microsoft.SharePoint.Portal (in Microsoft.SharePoint.Portal.dll)

Syntax

'Declaration
Public Shared Function GetContext ( _
    context As HttpContext _
) As PortalContext
'Usage
Dim context As HttpContext
Dim returnValue As PortalContext

returnValue = PortalApplication.GetContext(context)
public static PortalContext GetContext(
    HttpContext context
)

Parameters

Return Value

Type: Microsoft.SharePoint.Portal.PortalContext
A PortalContext object that represents the current application context.

Remarks

The GetContext method gets a cached PortalContext object from the specified HttpContext object.

The following table describes the exception types.

Exception Type

Condition

InvalidOperationException

The System.Web.HttpContext.Current static property is a null reference (Nothing in Visual Basic).

See Also

Reference

PortalApplication Class

PortalApplication Members

GetContext Overload

Microsoft.SharePoint.Portal Namespace