Sitecore 5.0 API

Context.IsBackgroundThread Property

Gets a boolean that indicates if the current thread is a background thread.

[Visual Basic]
Public Shared ReadOnly Property IsBackgroundThread As Boolean
[C#]
public static bool IsBackgroundThread {get;}

Property Value

True, if the current thread is a background thread, otherwise false.

Remarks

Sitecore may handle requests that are not part of a web request. Such requests are considered background or worker threads. An example is the scheduler which uses the API to perform certain tasks. When the scheduler executes, it does not run as a web request.

A developer may use this flag to take certain actions when the current thread is a background thread.

A background thread is defined by the current Http context is null:

HttpContext.Current == null

See Also

Context Class | Sitecore Namespace