简体   繁体   中英

Uploading a blob using HttpWebRequest in silverlight 5 causes SecurityException

I want to create a silverlight5 application to upload a file in blob storage using http request but when I end the response using

HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asyncResult);

it throws a 'Security error'. I have searched a lot for it and what I found is to upload a clientaccesspolicy.xml file to the root of my storage account. I have uploaded this file to my storage account at root level but it is not working. Please help me. Thanks in advance.

I found the mistake. Content in clientaccesspolicy.xml was bit wrong. I was using * in uri for domain

<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="SOAPAction">
      // for me, this line was was giving an error (using * for uri) 
      //   <domain uri="*" />
      //  now I am using 
         <domain uri="http://*" />
         <domain uri="https://*" />
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

thanks :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM