This topic has not yet been rated - Rate this topic

AspNetCompatibilityRequirementsAttribute.RequirementsMode Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets or sets the level of ASP.NET compatibility required by the service.

Namespace:  System.ServiceModel.Activation
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public AspNetCompatibilityRequirementsMode RequirementsMode { get; set; }

Property Value

Type: System.ServiceModel.Activation.AspNetCompatibilityRequirementsMode
The AspNetCompatibilityRequirementsMode that indicates the services required degree of ASP.NET compatibility. The default value is Allowed.
Exception Condition
InvalidEnumArgumentException

The value is not a valid one for the AspNetCompatibilityRequirementsMode enum.

Use the RequirementsMode property to set the hosting mode in code. This can also be done by setting an application-level configuration flag aspNetCompatibilityEnabled. For more information, see serviceHostingEnvironment.

At runtime, applications can detect whether ASP.NET compatibility mode is enabled by checking the value of the static property AspNetCompatibilityEnabled.


[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class CalculatorService : ICalculatorSession
{
    double result
    {   // Store result in AspNet session.
        get
        {
            if (HttpContext.Current.Session["Result"] != null)
                return (double)HttpContext.Current.Session["Result"];
            return 0.0D;
        }
        set
        {
            HttpContext.Current.Session["Result"] = value;
        }
    }

    public void Clear()
    {

    }

    public void AddTo(double n)
    {
        result += n;
    }

    public void SubtractFrom(double n)
    {
        result -= n;
    }

    public void MultiplyBy(double n)
    {
        result *= n;
    }

    public void DivideBy(double n)
    {
        result /= n;
    }

    public double Equals()
    {
        return result;
    }
}


.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8 Release Preview, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 SP2, Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)