467,921 Members | 1,336 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,921 developers. It's quick & easy.

events of a remoted object

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
  • viewed: 4194
Share:
2 Replies
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
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.

Similar topics

2 posts views Thread by Nick | last post: by
3 posts views Thread by jabailo | last post: by
1 post views Thread by Steve Drake | last post: by
3 posts views Thread by Grant Schenck | last post: by
reply views Thread by =?Utf-8?B?Sm9obiBXLg==?= | last post: by
1 post views Thread by almir | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.