Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. COThanks for this solution. This expands on what Crimson provided above, and I like the custom attribute solution. Just for my understanding, what is it about the code above where IsAjaxRequest == true that short-circuits MVC from executing the action method? Is it the setting of the StatusCode to 200 or setting the Result? Both? Once the statuscode is 200, I don't see what is keeping MVC from routing the request to the appropriate action method.
      singulars
    2. COI can't make this code execute once a user's login has timed out. I compiled this code into my project and attached the AuthorizeWithAjax attribute to my controller. I put a breakpoint on the base.On... line, and the breakpoint is only hit when a request is made on the controller and the user's login has not timed out. Once timed out, the breakpoint is never hit. It's as if forms authentication reroutes the user to the login page before the controller code is ever called. It makes me wonder if the standard Authorize attribute is ever hit in this scenario.
      singulars
    3. COTo answer the first comment is yes, it is the 200 that prevents the redirect from firing. As for the second one, make sure you don't have a standard Authorize there as well. This one serves as both. If you only have the AuthorizeWithAjaxAttribute there and you're still getting the behavior of the breakpoint not firing, my second guess is attribute order.
      singulars
 

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