title: .NET Remoting, passing objects into methods
body: <p>I am writing a .NET Remoting application. I have my dll, server, and client all working correctly. However, when I try to change my method call to take an object parameter instead of a simple type like an int, it complains with this error.</p>
  
  <blockquote>
    <p>Type System.Runtime.Remoting.ObjRef and the types from it (such as
    System.Runtime.Remoting.ObjRef) are not permitted to be deserialized
    at this security level.</p>
  </blockquote>
  
  <p>The method is something like this.</p>
  
  <pre><code>public List&lt;Orders&gt; GetOrders(int UserID) { //Works
  
  public List&lt;Orders&gt; GetOrders(Users user) { // Doesnt Work
  
  [Serializable]
  public class Users : MarshalByRefObject {
  </code></pre>
  
  <p>Now I have made the User class also, [Serializable] and given it MarshalByRefObject inheritance. Could this be my problem? I have tried removing [Serializable] from the User class and it complains cause it cant interpret it.</p>
  
  <p><strong>EDIT</strong>
  Ok, here is my client method.</p>
  
  <pre><code>IChannel channel = new TcpClientChannel();
  ChannelServices.RegisterChannel(channel, false);
  CustomType Server = (CustomType)Activator.GetObject(typeof(CustomType), "tcp://localhost:9934/CustomType");
  </code></pre>
  
  <p>Here is my server.</p>
  
  <pre><code>BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();
  provider.TypeFilterLevel = TypeFilterLevel.Full;
  IDictionary props = new Hashtable();
  props["port"] = 9934;
  TcpChannel channel = new TcpChannel(props, null, provider);
  ChannelServices.RegisterChannel(channel);
  RemotingConfiguration.RegisterWellKnownServiceType(typeof(CustomType), "CustomType", WellKnownObjectMode.Singleton);
  Console.WriteLine("Server is initialized");
  Console.ReadLine();
  </code></pre>