BasicHttpSecurityMode Enumeration

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

Specifies the types of security that can be used with the system-provided BasicHttpBinding binding.

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

Syntax

'Declaration
Public Enumeration BasicHttpSecurityMode
public enum BasicHttpSecurityMode

Members

Member name Description
Supported by Silverlight for Windows Phone None The SOAP message is not secured during transfer. This is the default behavior.
Supported by Silverlight for Windows Phone Transport Security is provided using HTTPS. The service must be configured with SSL certificates. The SOAP message is protected as a whole using HTTPS. The service is authenticated by the client using the service’s SSL certificate.
Supported by Silverlight for Windows Phone TransportWithMessageCredential This mode provides integrity, confidentiality, and server authentication using HTTPS. The service must be configured with a certificate. Client authentication is provided by SOAP message security.

This mode is applicable when the user is authenticating with a UserName or Certificate credential and there is an existing HTTPS deployment for securing message transfer.

Supported by Silverlight for Windows Phone TransportCredentialOnly This mode provides only HTTP-based client authentication. It does not provide message integrity or confidentiality.

Remarks

The default behavior for BasicHttpBinding is None. To specify another value, use the BasicHttpBinding(BasicHttpSecurityMode) constructor.

Examples


            'Constructors set with different security modes
            Dim defaultNoSecurityPDBinding As New PollingDuplexHttpBinding()
            Dim transportSecurityPDBinding As New PollingDuplexHttpBinding(BasicHttpSecurityMode.Transport)
            Dim transportCredentialOnlyPDBinding As New PollingDuplexHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly)

            'Get the BasicHttpSecurity from the binding
            Dim defaultSecurity As BasicHttpSecurity = defaultNoSecurityPDBinding.Security
            Dim transportHttpSecurity As BasicHttpSecurity = transportSecurityPDBinding.Security
            Dim transportCredentialOnlyHttpSecurity As BasicHttpSecurity = transportCredentialOnlyPDBinding.Security

            'Get the defaultSecurityMode
            Dim defaultSecurityMode As BasicHttpSecurityMode = defaultSecurity.Mode

            'Output for binding with no security: None
            Dim txtdefaultSecurityMode As String = defaultSecurityMode.ToString()

            'Get the transportSecurityMode
            Dim tansportSecurityMode As BasicHttpSecurityMode = transportHttpSecurity.Mode

            'Output for binding with transport security: Transport
            Dim txtTransportSecurityMode As String = tansportSecurityMode.ToString()

            'Output txtSecurityMode for binding with transport credential security: TransportCredentialOnly
            Dim txtTransportCredentialOnlySecurityMode As String = transportCredentialOnlyHttpSecurity.Mode.ToString()

            'Change the SecurityMode for a binding
            defaultSecurityMode = BasicHttpSecurityMode.TransportCredentialOnly

            'Output for binding with transport credential only security: TransportCredentialOnly
            Dim txtChangedSecurityMode As String = defaultSecurityMode.ToString()


            //Constructors set with different security modes
            PollingDuplexHttpBinding defaultNoSecurityPDBinding = new PollingDuplexHttpBinding();
            PollingDuplexHttpBinding transportSecurityPDBinding = new PollingDuplexHttpBinding(BasicHttpSecurityMode.Transport);
            PollingDuplexHttpBinding transportCredentialOnlyPDBinding = new PollingDuplexHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);

            //Get the BasicHttpSecurity from the binding
            BasicHttpSecurity defaultSecurity = defaultNoSecurityPDBinding.Security;
            BasicHttpSecurity transportHttpSecurity = transportSecurityPDBinding.Security;
            BasicHttpSecurity transportCredentialOnlyHttpSecurity = transportCredentialOnlyPDBinding.Security;

            //Get the defaultSecurityMode
            BasicHttpSecurityMode defaultSecurityMode = defaultSecurity.Mode;

            //Output for binding with no security: None
            string txtdefaultSecurityMode = defaultSecurityMode.ToString();

            //Get the transportSecurityMode
            BasicHttpSecurityMode tansportSecurityMode = transportHttpSecurity.Mode;

            //Output for binding with transport security: Transport
            string txtTransportSecurityMode = tansportSecurityMode.ToString();

            //Output txtSecurityMode for binding with transport credential security: TransportCredentialOnly
            string txtTransportCredentialOnlySecurityMode = transportCredentialOnlyHttpSecurity.Mode.ToString();

            //Change the SecurityMode for a binding
            defaultSecurityMode = BasicHttpSecurityMode.TransportCredentialOnly;

            //Output for binding with transport credential only security: TransportCredentialOnly
            string txtChangedSecurityMode = defaultSecurityMode.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.

See Also

Reference