Sitecore 5.0 API

Context Class

Represents the current state for this request.

For a list of all members of this type, see Context Members.

System.Object
   Sitecore.Context

[Visual Basic]
Public Class Context
[C#]
public class Context

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The Context object holds information about the current state such as current database, current language, current domain etc.

Many of these properties are resolved in the HttpRequest pipeline which runs on every request. The pipeline resolves the current site and sets many of the properties on the Context object from this site, e.g. database, current item and language.

Example

The following example gets the Home item in the current database

{{
public void Item GetHome() {
  return Sitecore.Context.Database.Items["/sitecore/content/Home"];
}
}}

Requirements

Namespace: Sitecore

Assembly: Sitecore.Kernel (in Sitecore.Kernel.dll)

See Also

Context Members | Sitecore Namespace