Export (0) Print
Expand All

IChannelReceiverHook.AddHookChannelUri Method

Adds a URI on which the channel hook will listen.

Namespace:  System.Runtime.Remoting.Channels
Assembly:  mscorlib (in mscorlib.dll)

void AddHookChannelUri(
	string channelUri
)

Parameters

channelUri
Type: System.String

A URI on which the channel hook will listen.

ExceptionCondition
SecurityException

The immediate caller does not have infrastructure permission.

Client code should not call this method directly.

   class CustomChannel : BaseChannelWithProperties, IChannelReceiverHook,
                         IChannelReceiver, IChannel, IChannelSender {

      public void AddHookChannelUri(string channelUri) {

         if (channelUri != null) {
            string [] uris = dataStore.ChannelUris;
				
            // This implementation only allows one URI to be hooked in. 
            if (uris == null) {
               string [] newUris = new string[1];
               newUris[0] = channelUri;
               dataStore.ChannelUris = newUris;
               wantsToListen = false;
            } else {
               string msg = "This channel is already listening for " +
                  "data, and can't be hooked into at this stage.";
               throw new System.Runtime.Remoting.RemotingException(msg);
            }
         }
      }
      // The rest of CustomChannel's implementation.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Show:
© 2015 Microsoft