开发者

REST, HTTP verbs and current development in .NET and silverlight

I've read several posts in the internet about that Silverlight only supports GET and POST, and that the most of the we开发者_Go百科b browsers too. Is this true? has it changed lately? I'm developing a RESTful web service for a Silverlight application, still in early stage, and I'd like to know if I should use just POST and GET, or otherwise I could use PUT and delete.

Cheers


Generally the other verbs are blocked in some way between your browser and your server. If you are implementing REST correctly, you will definitely need access to PUT and DELETE.

You can place the verb you want to use in an additional header, that then replaces the GET verb just before the web service is called. Use the x-http-method-override header to do this as well as something like the WCF Rest starter kit which has code to do the conversion of the verb:

http://www.msdev.com/Directory/Description.aspx?eventId=1316


When using the Browser HTTP stack only GET ans POST are supported. However the Client HTTP stack provided by Silverlight itself can send other verbs such as PUT. Hence it is possible to consume a typicall RESTFul API in Silverlight.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜