Silverlight : During uploading files to a URL, how to bypass the in-browser trusted application restriction?

StackOverflow https://stackoverflow.com/questions/10071170

문제

I have build a Silverlight 5 application that allows users to drag and drop an item onto a selected area and upload them to a particular URL. Its an HTML page that references the xap file (that contains the Silverlight code) inside a div through the object tag. The purpose is that when the user drags an element into that div, the element should be uploaded to the server specified.

The problem is that for uploading the dragged item, I need to call FileInfo's getFullName() method and it requires the user to be trusted. Since the Silverlight application will run inside the div of the HTML page, I am assuming that its a case of in-browser access, and according to this article, it would require a change in the end user's IE settings. Asking the user to change his registry keys for uploading files is obviously not an option.

Is there any way out of the situation (that is, if I have understood the situation correctly) ?

도움이 되었습니까?

해결책

You don't need to call FileInfo.getFullName() to be able to upload the file to the server. Instead, you call the FileInfo.OpenRead() method, which returns a stream that reads the file's data.

An example of using drag-and-drop with user-supplied files can be found here.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top