Asp.net WEB API - 如果我使用POST而不是PUT和DELETE可能会出现什么问题? [英] Asp.net WEB API - What problems could arise if I use POST instead of PUT and DELETE?

查看:331
本文介绍了Asp.net WEB API - 如果我使用POST而不是PUT和DELETE可能会出现什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用的Web API,虽然我发现它真的很容易创建的方法和一些配置,我需要,我现在遇到一个问题,我不知道如何解决。

I'm just starting to use Web API and though I found it really easy to create the methods and some configurations I needed, now I run into a problem I don't know how to solve.

一些会消耗我的服务是很旧,不支持DELETE和应用程序的PUT方法(如J2ME应用程序)

Some of the applications that will consume my services are very old and don't support DELETE and PUT methods (j2me applications for example)

我发现,它有可能通过传递这样的事情做一些样的方法模拟的:

I have found that it is possible to do some kind of method emulation by passing something like this :

_method=DELETE|PUT 

不过,我真的不知道,如果网页API将能够跨preT这再说,我没有不懂怎样做。
基于这些原因,我想在仅仅使用POST方法来处理更新和删除。
话虽如此,我可以期待什么并发症没有使用所有标准方法??

However, I'm not really sure if Web API will be able to interpret this and besides, I don't have the faintest idea how to do it. For those reasons I'm thinking in just using POST methods to handle updates and deletes. Having said that, what complications can I expect from not using all the standard methods??

一如往常的任何帮助将是pciated不胜AP $ P $

As always any help will be GREATLY appreciated

先谢谢了。

Pd积。它这将会是巨大的,如果有人知道如何使一个POST以 _method 被路由到DELETE()或PUT()

P.D. It it'd be great if anyone knew how to make the a POST with a _method be routed to the DELETE() or PUT()

推荐答案

感谢罗伯特·利维我知道这个问题怎么叫。有一次,我知道问题是什么,我做了一点googlig在这个博客,我发现如何解决这个问题:

Thanks to Robert Levy I knew how this problem was called. Once I knew what the problem was , I did a little googlig and in this blog I found how to solve it:

<一个href=\"http://www.hanselman.com/blog/HTTPPUTOrDELETENotAllowedUseXHTTPMethodOverrideForYourRESTServiceWithASPNETWebAPI.aspx\" rel=\"nofollow\">http://www.hanselman.com/blog/HTTPPUTOrDELETENotAllowedUseXHTTPMethodOverrideForYourRESTServiceWithASPNETWebAPI.aspx

这篇关于Asp.net WEB API - 如果我使用POST而不是PUT和DELETE可能会出现什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆