Download image from silverlight webpart in sharepoint2010 - silverlight

I want to download a image from any URL through silverlight webpart in Sharepoint 2010.
I am able to download image from the same site, but not from other ones (within the same server itself).
I am using WebClient class and opening the image file asynchronously.
Please suggest some ways to achieve this.

Related

Aspose PDF viewer

I am using the Aspose PDF tools and have successfully got it to print the pdf which is great, but ideally I want to be able to add a wpf control to display this as well.
I would have assumed that the PdfViewer class would have something, but I can't tell.
So far I have needed to use a different control MoonPdfPanel which is annoying as I would have preferred 1 tool to do both jobs.
Does anyone know of a control I can use to hook into the aspose?
Thanks
We have developed an HTML5 PDF Editor application using Aspose.Pdf for .NET API which you can use in your application as a PDF Viewer as well. You can get the details and complete source code here. You can use the source code to edit the viewer as per your requirement.
P.S. I am working as social media developer at Aspose.
Well, if you are interesting in viewing the PDF file, you may convert the file to HTML and display it using an IFrame in your application. I have developed a sample application which performs different operations including viewing a PDF file in IFrame. Download it and try it at your end. Another option is that you can convert the PDF file to images and display in Imageviewer in your application (Code is available in the above application).
P.S. I am working as social media developer at Aspose.

Loading Images for Silverlight app from server without ssl

I have an Silverlight application that uses ssl to communicate with the site-of-origin. The application loads a number of images from a separate server (running apache under port 81 without ssl). The images are regular png's. The images from the Apache machine are not loaded properly, i.e. the image control remains blank. When I post the same image on my app server (i.e. site-of-origin), and modify the link accordingly, the images are displayed properly. This link on MSDN says that images are media are excluded from access-restriction policies.
Would appreciate any suggestions.
I hope you are deploying your Silverlight application to a web server and not running it using the Visual Studio development server. I had a similar problem with images when I was using the built in development web server. You can find about my experience here.
It might help if you subscribe to ImageFailed event and post the stacktrace.
You are running into cross-scheme access restrictions in silverlight, see table at the bottom of http://msdn.microsoft.com/en-us/library/cc189008(v=vs.95).aspx
One possible solution is to load image using WebClient and call SetSource on image element. That is what we do in our app. In fact we wraped it into custom image control that hides all annoying details.

windows phone webbrowser control file download

I have a file hosted in a secured site (https), so I use the web browser control to pass the URL and the headers for authentication. Can the WebBrowser control render the document/pdf files just like the phone native browser. Even the public document(not secure) are not rendering. Does the webbrowser control similar to the native phone IE when it comes to file download?
If you just want to open a PDF from a web location you'll have to do:
new WebBrowserTask
{
Uri = new Uri("http://path.to/file.pdf", UriKind.Absolute)
}.Show();
This depends on the user having the Adobe, PDF viewer app installed on their phone. There's no way to show a PDF document within the WebBrowser control.

Silverlight 4: Upload file control?

I'm looking for a simple control that will allow the user to upload an image (or any file, really.) However, I'm not seeing it in the VS 2010 control toolbox. Is there something I'm overlooking? What's the idiomatic way to do file upload?
I am developing a Silverlight app hosted in a ASP.NET page from Windows Azure.
Thanks. I'm new to Silverlight.
The most widely used file upload control suggested by Tim Huer is the sl file uploader. It allows you uploading through wcf or asp.net handler. It supports multiple files, a lite version for single file uploads.
I have developed a control that should help you in your effort: Parallel upload to Azure via Silverlight Control

Cross-site images in Silverlight

Is it possible to load in an image from another domain using JavaScript, and then pass the image to a Silverlight control on my page?
The only workaround I'm familiar with for this, since it's a security issue, is to set up a web service on a server you have control over, request the image from this web service from your Silverlight application, then have the service grab the image from the other server and return it to the client.
Loading cross-domain images should not be an issue in Silverlight, at least if you are using the normal Image control. I just tested this with a really simple application containing only an Image control with the Source property set to an image from google images.
Are you loading your images in some funky way with the WebClient? Cross-scheme and cross-zone access is restricted for the Image class, so you would not be able to load an image (on any domain) over SSL if you loaded your XAP over regular HTTP.
The MSDN page on Silverlight URL Access Restrictions gives you a good overview of what you can and cannot do with Image, MediaElement, WebClient, and streaming video.

Resources