Any reason not to trust ASP.NET AntiForgeryToken?

試著忘記壹切 提交于 2019-11-28 21:25:50
shrisha

The one limitation we ran into with the default implementation was the lack of out-of-the-box support for AJAX calls. The hidden field approach works for sites that primarily deal with traditional form POSTs; but, not quite for AJAX heavy sites like SO.

We implemented the approach outlined in this CodeThinked blog post and we couldn't be happier. It looks like Phil Haack also supports this approach, based on his oct 2011 blog post

Couple of (unsolicited, I know!) pointers:

  1. if you are running a web-farm, you should, of course use a static machinekey in your Web.config
  2. Make sure all your servers have this KB installed. Otherwise, you may run into machinekey validation issues
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!