IChannelReceiverHook.AddHookChannelUri Method (String)


Adds a URI on which the channel hook will listen.

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

void AddHookChannelUri(
	string channelUri


Type: System.String

A URI on which the channel hook will listen.

Exception Condition

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.


for operating with infrastructure code. Demand value: SecurityAction.LinkDemand; Permission value: SecurityPermissionFlag.Infrastructure

.NET Framework
Available since 1.1
Return to top