杀死一个HTTP POST请求 [英] Kill a http post request

查看:426
本文介绍了杀死一个HTTP POST请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用反伪造令牌来处理重复的形式张贴作为回答的 这里 这个问题时重复相同的形式POST请求到达时,成功地确定,但我不能妥善处理出现。我做

I am trying to handle the duplicated form posting by using the anti forgery token as answered here the problem arises when a duplicate identical form post request arrives it is successfully identified but i am unable to handle it properly. I am doing

   if (ctx.Session["userform"] != null)
   {
       if (_antiForgToken.Equals(ctx.Session["userform"].ToString()))
       {
           //kill the request
           response.Clear();
           response.ClearContent();
           response.Close(); 
       }
   }
   else
       ctx.Session["userform"] = _antiForgToken;          
}

问题是我怎么能刚落复制的HTTP请求,就好像它从来没有发生过......

the question is how can i just drop the duplicated HTTP request as if it never happened...

推荐答案

您还需要由客户正确和公正查杀响应将不利于提出的要求。也许发送与效应初探状态code 400。

You still need to respond to the request made by the client right and just killing the response will not help. Probably send a reponse with a status code 400.

400 Bad Request

The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.

这篇关于杀死一个HTTP POST请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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