Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC AntiForgeryToken Issues - IE9 and Chrome
    primarykey
    data
    text
    <p>We have a real Heisenbug on our hands: we've implemented the MVC 3 AntiForgeryToken technology on our websites and are running into intermittent but extremely frustrating bad request errors. They seem to be mostly on IE9 (less so on Chrome, not on Firefox), and sometimes, but not always, disappear when the user clears their cache and then closes and restarts their browser.</p> <p>The main coder on this (no longer with the company) did a few non-standard things in the implementation that I'm wondering about:</p> <ol> <li><p>Instead of a [ValidateAntiForgeryToken] attribute decorating each controller method, he put an explicit declaration of the attribute in a base controller class that all our controllers descend from. I'm wondering if that might have something to do with how the tokens get generated.</p></li> <li><p>We have the tokens in our AJAX calls which in many cases return entire HTML pages (mostly popups). This results in two or more tags an a page, each with their own verification tokens - which are different from each other as well as from the cookie value that's used to verify. We have included code in our jQuery AJAX calls to include the value of the VerificationToken (see <a href="https://stackoverflow.com/questions/1346070/asp-net-mvc-antiforgerytoken-over-ajax">ASP.net MVC AntiForgeryToken over AJAX</a>). The fact that the pages work most of the time is telling me that the proper hidden token is getting posted to be authorized, but I'd like to know what is going wrong when it doesn't.</p></li> </ol> <p>I'm trying to put a try-catch block in the verification method that would at least give us the cookie value and the token to see if they both exist. Can anyone think of other values that would be useful in the debugging process? Are there time limits on the tokens - we have had some errors when just sitting on a page for a certain amount of time.</p> <p>Finally, why would the errors suddenly appear on a production server and nowhere else in the development lifecycle?</p> <p>Any clues to this would me most helpful.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload