We have built a Silverlight app (2.4 API on IIS7) that is capable of exporting the visible map extent including all map layers and graphiclayers to a PNG image. To do this, we export the Grid the map is in to a WritableBitmap, like this:
private static byte[] GridToByteArray(UIElement grid) { var writeableBitmap = new WriteableBitmap(grid, null); writeableBitmap.Invalidate(); var pngStream = Encode(writeableBitmap); var printBuffer = new Byte[pngStream.Length]; pngStream.Read(printBuffer, 0, printBuffer.Length); return printBuffer; }
This works well, provided that all layers from outside the domain go through a Proxy.ashx. If we don't use a Proxy, we get a "WriteableBitmap has protected content. Pixel access is not allowed" error. The proxy.ashx we use is unmodified from http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jshelp_start.htm#jshelp/.... Its Proxy.config file has of course been modified to use the <ServerUrls> we need.
So far this solution works well with ArcGIS Tiled and Dynamic layers from outside of the domain. The trouble is that we want to use WMS layers as well. I can't get this to work with the Proxy. if I add e.g. the serverUrl