System.Net.SSPIWrapper.QueryContextChannelBinding C# (CSharp) Method

QueryContextChannelBinding() public static method

public static QueryContextChannelBinding ( System.Net.Security.SSPIInterface secModule, SafeDeleteContext securityContext, System.Net.Interop contextAttribute ) : SafeFreeContextBufferChannelBinding
secModule System.Net.Security.SSPIInterface
securityContext SafeDeleteContext
contextAttribute System.Net.Interop
return SafeFreeContextBufferChannelBinding
        public static SafeFreeContextBufferChannelBinding QueryContextChannelBinding(SSPIInterface secModule, SafeDeleteContext securityContext, Interop.SspiCli.ContextAttribute contextAttribute)
        {
            if (NetEventSource.IsEnabled) NetEventSource.Enter(null, contextAttribute);

            SafeFreeContextBufferChannelBinding result;
            int errorCode = secModule.QueryContextChannelBinding(securityContext, contextAttribute, out result);
            if (errorCode != 0)
            {
                if (NetEventSource.IsEnabled) NetEventSource.Exit(null, $"ERROR = {ErrorDescription(errorCode)}");
                return null;
            }

            if (NetEventSource.IsEnabled) NetEventSource.Exit(null, result);
            return result;
        }

Usage Example

 public unsafe static SafeFreeContextBufferChannelBinding QueryContextChannelBinding(SafeDeleteContext securityContext, ChannelBindingKind attribute)
 {
     return(SSPIWrapper.QueryContextChannelBinding(GlobalSSPI.SSPISecureChannel, securityContext, (Interop.SspiCli.ContextAttribute)attribute));
 }