加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc – 为什么应该使用HTTP POST或DELETE而不是GET删除

发布时间:2020-12-15 19:06:11 所属栏目:asp.Net 来源:网络整理
导读:我一直在通过微软的ASP.NET MVC教程,最后在这个页面 http://www.asp.net/learn/mvc/tutorial-32-cs.aspx 下面的语句是在这个页面的底部: In general,you don’t want to perform an HTTP GET operation when invoking an action that modifies the state o
我一直在通过微软的ASP.NET MVC教程,最后在这个页面

http://www.asp.net/learn/mvc/tutorial-32-cs.aspx

下面的语句是在这个页面的底部:

In general,you don’t want to perform an HTTP GET operation when invoking an action that modifies the state of your web application. When performing a delete,you want to perform an HTTP POST,or better yet,an HTTP DELETE operation.

这是真的?任何人都可以提供更详细的解释这个声明背后的理由吗?

编辑

Wikipedia规定如下:

Some methods (for example,HEAD,GET,OPTIONS and TRACE) are defined as safe,which means they are intended only for information retrieval and should not change the state of the server.

By contrast,methods such as POST,PUT and DELETE are intended for actions which may cause side effects either on the server

解决方法

Jon Skeet的答案是规范的答案。但是:假设你有一个链接:
href = "myAppDeleteImportantData.aspx?UserID=27"

和google-bot来和你的页面索引?那么会发生什么呢?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读