2011-11-25 107 views
0

我试图通过使用反伪造令牌来处理重复的表单发布作为回答here问题出现时,重复相同的表单post请求到达它被成功识别,但我无法处理它正常。我做杀死一个http post请求

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请求,就好像它从来没有发生过......

回答

1

你仍然需要由客户正确和公正杀死提出的要求作出回应该反应将无济于事。可能发送一个状态码为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.