Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have the MVC 3 anti-CSRF solution implemented, and I never receive 403 code when purposely making the check to fail (by suppressing cookies on client side after the get and before the post).</p> <p>Check done on an action having a ValidateAntiForgeryToken attribute. cutomErrors set with RemoteOnly, then On, then Off. Tested twice, first time on Cassini dev server, second time on IIS6. </p> <p>I have always received a 500 response code.</p> <p>I guess the trouble is located in the customErrors handling you are using. You should also check if you have any httpModule doing some custom logic on error events. (Unlikely if you use MVC HandleError attribute, as this MVC customError handling traps the errors before HttpModule handling, which then never see errors.)</p> <p>Without more details in your question about which customError handling mechanism are you using, it is difficult to give more directions.</p> <p>Mine is neither the MVC standard one (using HandleError as controller attribute, action attribute or global filter), nor the classical asp.net one. It is not ELMAH either. I handle errors in Application_Error event due to "historical" reasons (and for I found it easier to support both ISS 6 and 7 error handling, which I need to do till the migration of our servers is done). Code of my error handling logic in Application_Error event is like :</p> <pre><code>var statusCode = 500; var ex = Server.GetLastError(); if (ex != null) { var httpEx = ex as HttpException; if (httpEx != null) { // HttpAntiForgeryException is HttpException and gets received here, // so its statusCode is what I get here. statusCode = httpEx.GetHttpCode(); } } // Some logging logic then if (!Context.IsCustomErrorEnabled) return; Response.ClearContent(); Response.StatusCode = statusCode; // Rendering custom error page in response then Server.ClearError(); </code></pre>
    singulars
    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.
    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