When I do $ http.post for a web API from my client on a separate project, both Firebug and Chrome are an option Method and then a POST method
Problem My app These lines are in JS: My API call: webpi web.config If you use the nightly consoles package, the message handler to the option request that Does not execute the action, but still sends the appropriate response title. For more information and how to use night packages, you should see this blog post about the CORS Knightley package. Be sure to select "prelease" from the drop down.
Both of the requests actually execute my API action if I am restricted to posting, the option fails and Post never happens. CORS is in my corner and webpage.
$ httpProvider.defaults.useXDomain = true; Remove $ HttpProvider.defaults.headers.com ['X-Requested-With'];
$ scope.add = function () {var role = {name: 'admin'}; $ Http.post ('http: // localhost: 7514 / roll / add', role) success (work) {alert ('rollerscountryr.ed');}) error (function (message) {warnings ('expelled Gone rollers controller.ed ');}); };
& lt; System.webServer & gt; ... & lt !! - Added for cos handling, delete when using a dedicated cours handler or system. WEB.cors dll - & gt; & Lt; HttpProtocol & gt; & Lt; CustomHeaders & gt; & Lt; Add name = "access-control-permission-origin" value = "*" /> & Lt; Add name = "access-control-permission-header" value = "origin, with requested-type, accept content type," /> & Lt; / CustomHeaders & gt; & Lt; / HttpProtocol & gt; & Lt; /system.webServer>
No comments:
Post a Comment