Brian did a fantastic job showing us how to use a little-known feature of Silverlight. Local messaging between instances of Silverlight controls, and even out-of-browser apps, is pretty neat. Below is a reply of our geekSpeak webcast followed by resources from Brian around the topic.
Joe Stegman's "Local Messaging Sample" blog post: http://blogs.msdn.com/b/jstegman/archive/2009/03/23/local-messaging-samples.aspx My "Local Messaging" blog post with sample code: http://www.brianlagunas.com/index.php/2010/05/01/communicating-between-silverlight-applications/ MSDN documentation on Local Messaging: http://msdn.microsoft.com/en-us/library/dd833063(VS.95).aspx
Some questions from the webcast:
Could someone use reflection on a Silverlight XAP to see the channel name? If so, is there a way to prevent this?
Yes, if your channel names are hardcoded, someone can download and unzip the XAP file and reflect into your assemblies. To help prevent this, you could generate your receiver names at runtime, using the current date and time to ensure uniqueness. You can then retrieve the generated names in the sending and receiving applications through a web service. Also, you could scope your receiver names by domain, and check the MessageReceivedEventArgs.SenderDomain and verify the domain the sender is from.
Any specific guidance for using messaging with Silverlight controls hosted on SharePoint
Local messaging works the same way in SharePoint as it does in HTML. Here is a pretty good example which demonstrates local messaging in SharePoint 2010.