1

The tutorial Preventing CSRF by Mike Wasson, introduces a method called GetTokens() that is supposed to reside within the System.Web.Helpers.AntiForgery class (as confirmed on MSDN here).

I am using ASP.NET 4.0, C#, and MVC 3 and cannot find this method anywhere. It doesn't exist, and the MSDN page about the method doesn't not give any hints as to which version of the framework contains the GetTokens() method. Am I missing something? I left a comment on Mike Wasson's post, but he apparently doesn't read the comments there (at least not anymore) because I'm the second person to raise the question there and there are no responses.

Where can I find this method?

4

1 回答 1

1

此方法(以及 HttpRequestMessage 类本身)是 .NET 4.5 的新方法。您很可能使用的是该框架的旧版本。但是您仍然可以手动遍历标头并检查特定标头是否存在。

于 2013-09-26T22:47:20.120 回答