none
How can I manage assets in Silverlight using REST API? RRS feed

  • Question

  • Hi all:

    Currently,We need to convert the videos that are uploaded to azure storage by users to specific formats.

    We have silverlight upload controls.And we plan to do that  using media services REST API in silverlight.

    Before we make any requests that are crossing domains, Silverlight will check if there is a policy file in target domain.

    But it seems that we can not access the policy file https://media.windows.net/clientaccesspolicy.xml.

    The details are listed below.

    Does the file exist right now or there are other things I should do before accessing the file?

    Thanks,

    EddyLin


    Monday, January 14, 2013 7:45 AM

Answers

  • Hi Eddy,

    We haven't forgotten about this thread, it has been the subject of a lengthy internal email. 

    At this time, you will not be able to use REST directly via Silverlight.  This is because of the concerns that you have highlighted: the lack of a crossdomain policy file at the https://media.windows.net/ endpoint.

    That endpoint expects the authorization header to contain and ACS bearer token (see here for generating one in C#).  Based on the bearer token, it will thow a 304 redirect to the datacenter that is hosting the account.  It also expects an xms-version header to ensure that it is using the right REST version for the service (this is the error you saw).

    Silverlight, on the other hand, will request an accesspolicy file prior to making any further calls on the endpoint.  Because of those security limitations, it cannot add the authorization or xms-version headers, nor is the endpoint setup to do anything but redirection.

    So you are at an impass there.

    On another note:  to use Silverlight would mean that Silverlight would have your Media Services account name and account key. Even as a desktop app, this is probably too much exposure of this sensitive data (Silverlight is easily decompiled, just rename the .xap to .zip and browse away!).

    You can still use Silverlight as a front-end UI, just add a WCF tier behind it to make the calls to Windows Azure Media Services.  In WCF, you can use REST directly, or compile-in the .Net SDK.

    Regards,

    -Nick Drouin


    Monday, January 28, 2013 9:09 PM

All replies

  • Hi,

    Since the issue is related to Iaas, I have moved this thread to Media Srevice forums for getting a better support.

    Thanks for your understanding.


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, January 15, 2013 3:24 AM
  • Hi Eddy,

    We haven't forgotten about this thread, it has been the subject of a lengthy internal email. 

    At this time, you will not be able to use REST directly via Silverlight.  This is because of the concerns that you have highlighted: the lack of a crossdomain policy file at the https://media.windows.net/ endpoint.

    That endpoint expects the authorization header to contain and ACS bearer token (see here for generating one in C#).  Based on the bearer token, it will thow a 304 redirect to the datacenter that is hosting the account.  It also expects an xms-version header to ensure that it is using the right REST version for the service (this is the error you saw).

    Silverlight, on the other hand, will request an accesspolicy file prior to making any further calls on the endpoint.  Because of those security limitations, it cannot add the authorization or xms-version headers, nor is the endpoint setup to do anything but redirection.

    So you are at an impass there.

    On another note:  to use Silverlight would mean that Silverlight would have your Media Services account name and account key. Even as a desktop app, this is probably too much exposure of this sensitive data (Silverlight is easily decompiled, just rename the .xap to .zip and browse away!).

    You can still use Silverlight as a front-end UI, just add a WCF tier behind it to make the calls to Windows Azure Media Services.  In WCF, you can use REST directly, or compile-in the .Net SDK.

    Regards,

    -Nick Drouin


    Monday, January 28, 2013 9:09 PM
  • Thanks, Nick.
    Tuesday, February 5, 2013 8:36 AM