I'm having trouble calling PUT and DELETE methods using Silverlight 5. I tried calling the resource with DELETE using another Client, and it worked. This also worked before with the WCF Web API, but it does not anymore with ASP.NET WebAPI.
I'm using the Client Stack which does support DELETE and PUT requests (http://msdn.microsoft.com/en-us/library/dd920295%28v=vs.95%29.aspx), and also I have a clientaccesspolicy.xml in my root folder.
The content of the clientaccesspoliy.xml is as followed:
I also added this to my RegisterRoutes method, to make the file accessible:
routes.IgnoreRoute("clientaccesspolicy.xml");
Every time I try to make a call I immediately get a SecurityException. The call does not even reach ASP.NET (Application_BeginRequest is not triggered).
MartinJ.
Member
243 Points
80 Posts
Silverlight problem calling PUT/DELETE methods
Apr 13, 2012 01:28 PM|LINK
Hello everyone!
I'm having trouble calling PUT and DELETE methods using Silverlight 5. I tried calling the resource with DELETE using another Client, and it worked. This also worked before with the WCF Web API, but it does not anymore with ASP.NET WebAPI.
I'm using the Client Stack which does support DELETE and PUT requests (http://msdn.microsoft.com/en-us/library/dd920295%28v=vs.95%29.aspx), and also I have a clientaccesspolicy.xml in my root folder.
The content of the clientaccesspoliy.xml is as followed:
<?xml version="1.0" encoding="utf-8"?> <access-policy> <cross-domain-access> <policy> <allow-from http-request-headers="*"> <domain uri="https://*"/> <domain uri="http://*"/> </allow-from> <grant-to> <resource path="/" include-subpaths="true"/> </grant-to> </policy> </cross-domain-access> </access-policy>I also added this to my RegisterRoutes method, to make the file accessible:
routes.IgnoreRoute("clientaccesspolicy.xml");Every time I try to make a call I immediately get a SecurityException. The call does not even reach ASP.NET (Application_BeginRequest is not triggered).
Any one knows how to solve this issue?
Bimalvv
Contributor
2356 Points
478 Posts
Re: Silverlight problem calling PUT/DELETE methods
Apr 13, 2012 01:33 PM|LINK
Modify this line like this
<allow-from http-request-headers="*" http-methods="*">
Bimal
MartinJ.
Member
243 Points
80 Posts
Re: Silverlight problem calling PUT/DELETE methods
Apr 13, 2012 01:39 PM|LINK
Good point, but no luck. This changes nothing. :(
edit: Whoops, I accidently modified the wrong file. It works, thank you very much. :) Do you perhaps have any explanation why this worked before?