Silverlight: HTTP DELETE and PUT methods with RestSharp

前端 未结 2 1992
不知归路
不知归路 2021-01-22 07:09

I wanted to access an internal REST API from Silverlight, but it turns out that I am not allowed to use POST or DELETE as the HTTP method for my request.

Doing so always

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-22 07:50

    SecurityException probably means the API doesn't have the proper clientaccesspolicy.xml file in place. Here's an example of a very lenient one that allows all HTTP methods and headers. We have used this successfully for our API (which is popular, though I don't know how much traffic we get from Silverlight).

    
    
      
        
          
            
            
          
          
            
          
        
      
    
    

    This needs to be placed in a clientaccesspolicy.xml file at the root of the domain the API you are trying to use is on.

提交回复
热议问题