ContextInformation.HostingContext Property

 

Gets the context of the environment where the configuration property is being evaluated.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

public object HostingContext { get; }

Property Value

Type: System.Object

An object specifying the environment where the configuration property is being evaluated.

The possible HostingContext value is WebContext, ExeContext, or null.

The following code example demonstrates how to use the HostingContext property.

// Create an object based on HostingContext.
WebContext myWC =
  (WebContext)config.EvaluationContext.HostingContext;
// Use the WebContext object to determine
// the ApplicationLevel.
Console.WriteLine("ApplicationLevel: {0}",
  myWC.ApplicationLevel);

.NET Framework
Available since 2.0
Return to top
Show: