I don't have alink with the whole solution, but the pieces and what I implemented on my project. Let's go step by step: About the solution: It's a workaround, SL cannot do that, what we do then is to workaround it using ASP .net / Javascript (in ASP .net it's possible to return a file to client as an attachment). In my case: --> I have an XML file on my client side (that represents the database diagram), it could be whatever that can be serializable. --> I have an WCF service that accepts as input parameter that XML file, I send a call from SL to the service (if you have question on this give me a shout and will try to find some tutorial about how to call services from SL). --> This service that I'm calling inherits the context from the ASP .net application, that is, we have the ASP .net session available, to enable this you only have to add to the header of your service class: [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class RenderService --> In my case I stored the XML file in a session variable in the server (so for that user we get the file in his session / memory). --> Once the Silverlight receives the callback from the service call (the service has been called successfully), I call from SL a javascript method:
public void ShowDiagramImageRenderPopup()
{
System.Windows.Browser.HtmlPage.Window.CreateInstance("showReportDiagramPopup");
}
--> This javascript methods opens a popup that points to a URL (if I want it to download a file I just have to open a page in the same navigator, the only thing is that the custom HTTP Handler must return an "attacment").
// Show the report render popup, I'm calling an ASPX that has inside a refernce to an image generated by
// a custom HTTP hanlder (the commented solution, was the one related to download an attachmen)
function showReportDiagramPopup() {
//http: //www.javascripter.net/faq/openinga.htm
window.open("DiagramRenderPopup.aspx", "DatabaseDiagram", "scrollbars=yes, width=800,height=600", false);
// NOT IN USE, rather using popup
// Finally we are not going to use a popup, we just open the generated image as an attachment
//window.location = "DiagramImageHandler.ashx"
}
--> Ok, now let's go for the CUstom HTTP Hanlder "DiagramImageHandler.ashx", the main code s