By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,492 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,492 IT Pros & Developers. It's quick & easy.

events of a remoted object

P: n/a
Dan
I am having a problem trying to assign event handlers to the events of
a remoted object. I have one program that registers the object for
remoting, Another that connects and calls methods on the object and a
third that connects to the object and waits for events. The error
occurs when I try to assign event handlers to the remoted object's
events in the third program (Listener).

hubListenerConnection.ContextRequest += new
Hub.ContextRequestEventHandler(hubListenerConnecti on_ContextRequest);

This line throws a System.Security.SecurityException

Additional information: Type System.DelegateSerializationHolder and
the types derived from it (such as System.DelegateSerializationHolder)
are not permitted to be deserialized at this security level.

The Hub (inherits MarshalByRefObject) object events are declared as
follows:

public delegate void ContextRequestEventHandler(object sender,
EventArgs.ContextRequestEventArgs e);

public event ContextRequestEventHandler ContextRequest;

protected virtual void
OnContextRequest(EventArgs.ContextRequestEventArgs e)
{
if (ContextRequest != null)
{
ContextRequest(this, e);
}
}

The custom EventArgs are declared with [Serializable] as is the
listener.

Any help with what I am doing wrong to get this error and what I can
do to make this system work?

Thanks,
Dan
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Dan,

Check out the article on CodeProject.com titled ".NET Remoting: Passing
through the obstacles path from version 1.0 to 1.1", which details how to
deal with this issue (it consists mainly of setting the type filter level on
the client and server). It is located at (watch for line wrap):

http://www.codeproject.com/csharp/Pa...ingArticle.asp

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dan" <da**************@srs.gov> wrote in message
news:45**************************@posting.google.c om...
I am having a problem trying to assign event handlers to the events of
a remoted object. I have one program that registers the object for
remoting, Another that connects and calls methods on the object and a
third that connects to the object and waits for events. The error
occurs when I try to assign event handlers to the remoted object's
events in the third program (Listener).

hubListenerConnection.ContextRequest += new
Hub.ContextRequestEventHandler(hubListenerConnecti on_ContextRequest);

This line throws a System.Security.SecurityException

Additional information: Type System.DelegateSerializationHolder and
the types derived from it (such as System.DelegateSerializationHolder)
are not permitted to be deserialized at this security level.

The Hub (inherits MarshalByRefObject) object events are declared as
follows:

public delegate void ContextRequestEventHandler(object sender,
EventArgs.ContextRequestEventArgs e);

public event ContextRequestEventHandler ContextRequest;

protected virtual void
OnContextRequest(EventArgs.ContextRequestEventArgs e)
{
if (ContextRequest != null)
{
ContextRequest(this, e);
}
}

The custom EventArgs are declared with [Serializable] as is the
listener.

Any help with what I am doing wrong to get this error and what I can
do to make this system work?

Thanks,
Dan

Nov 16 '05 #2

P: n/a
Dan
Thank you Nicholas, that example was very helpful. I now have the
system up and working. Though the event repeater being created by the
client and then remoted to the server works, the whole system would be
so much cleaner if the clients could subscribe to events of the server
object directly. Does anyone know if this will change with whidbey?

-Dan

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:<eF**************@TK2MSFTNGP12.phx.gbl>...
Dan,

Check out the article on CodeProject.com titled ".NET Remoting: Passing
through the obstacles path from version 1.0 to 1.1", which details how to
deal with this issue (it consists mainly of setting the type filter level on
the client and server). It is located at (watch for line wrap):

http://www.codeproject.com/csharp/Pa...ingArticle.asp

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dan" <da**************@srs.gov> wrote in message
news:45**************************@posting.google.c om...
I am having a problem trying to assign event handlers to the events of
a remoted object. I have one program that registers the object for
remoting, Another that connects and calls methods on the object and a
third that connects to the object and waits for events. The error
occurs when I try to assign event handlers to the remoted object's
events in the third program (Listener).

hubListenerConnection.ContextRequest += new
Hub.ContextRequestEventHandler(hubListenerConnecti on_ContextRequest);

This line throws a System.Security.SecurityException

Additional information: Type System.DelegateSerializationHolder and
the types derived from it (such as System.DelegateSerializationHolder)
are not permitted to be deserialized at this security level.

The Hub (inherits MarshalByRefObject) object events are declared as
follows:

public delegate void ContextRequestEventHandler(object sender,
EventArgs.ContextRequestEventArgs e);

public event ContextRequestEventHandler ContextRequest;

protected virtual void
OnContextRequest(EventArgs.ContextRequestEventArgs e)
{
if (ContextRequest != null)
{
ContextRequest(this, e);
}
}

The custom EventArgs are declared with [Serializable] as is the
listener.

Any help with what I am doing wrong to get this error and what I can
do to make this system work?

Thanks,
Dan

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.