I have a requirement to filter remoting requests by client IP. I'm using theClientIPInjectorSink code previously shared in this forum (http://social.msdn.microsoft.com/Forums/en-US/netfxremoting/thread/ded91335-39e9-47fb-9be2-9b430aae83c3) to capture the client's IP. Rather than just adding the address to CallContext though, I want to compare it to a list of valid addresses and ignore the request if the client IP is not in that list. By "ignore" I meanimmediately stop sink stack processing on the request. My preference would be tohang the application that generated the request by not responding at all. If I'm not able to do that I'd want to return a vague response along the lines of "operation not supported".
For synchronous operations my naive approach was simply to skip_NextSink.ProcessMessage(...) in theClientIPInjectorSink.ProcessMessage and returnServerProcessing.Complete with the "out" parameters set = null. However, theBinaryServerFormatterSink that's next in line does not like the null responseMessage and throws "System.Runtime.Remoting.RemotingException: Error dispatching message."
Is there a correct way to completely ignore a remoting request without raising an exception? Must I override my way up the whole sink stack to ensure that the client is ignored without an exception?
Thanks, Dave