Share via


BasicHttpBinding.Security Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the type of security used with this binding.

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

Syntax

'Declaration
Public ReadOnly Property Security As BasicHttpSecurity
public BasicHttpSecurity Security { get; }

Property Value

Type: System.ServiceModel.BasicHttpSecurity
The BasicHttpSecurity that is used with this binding. The default value is None.

Remarks

By default, the SOAP message is not secured and the client is not authenticated. To use a non-default type of security, use the BasicHttpBinding(BasicHttpSecurityMode) constructor or set the type of security for an existing binding using the Mode property.

Examples

            Dim bDefaultHttpBinding As New BasicHttpBinding()
            'Output txtSecurityMode: None
            Dim txtDefaultSecurityMode As String = bDefaultHttpBinding.Security.Mode.ToString()

            Dim bTHttpBinding As New BasicHttpBinding(BasicHttpSecurityMode.Transport)
            'Output txtSecurityMode: Transport
            Dim txtTSecurityMode As String = bTHttpBinding.Security.Mode.ToString()

            Dim bTOHttpBinding As New BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly)
            'Output txtSecurityMode: TransportCredentialOnly
            Dim txtTOSecurityMode As String = bTOHttpBinding.Security.Mode.ToString()

            BasicHttpBinding bDefaultHttpBinding = new BasicHttpBinding();
            //Output txtSecurityMode: None
            string txtDefaultSecurityMode = bDefaultHttpBinding.Security.Mode.ToString();

            BasicHttpBinding bTHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
            //Output txtSecurityMode: Transport
            string txtTSecurityMode = bTHttpBinding.Security.Mode.ToString();

            BasicHttpBinding bTOHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
            //Output txtSecurityMode: TransportCredentialOnly
            string txtTOSecurityMode = bTOHttpBinding.Security.Mode.ToString();

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.