Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC AsyncController xxxCompleted

When implementing ASP.NET MVC AsyncController the xxxCompleted method has to be Public. I'm wondering if this means the xxxCompleted method can be invoked directly, or if this is protected internally using NonAction or something similar?

Thanks.

like image 456
Dave Foster Avatar asked Nov 05 '22 07:11

Dave Foster


1 Answers

Internally (and simplistically), there's an array of MethodInfo of the actions on the async controller constructed. When it's constructed the Async and Completed suffixes are stripped off the action method names.

If you try an call an action method such as IndexCompleted this array is searched but because there isn't an IndexCompleted in the array (because the suffixes have been removed) the AsyncControllerActionInvoker reports that no action was found.

It's worth having a poke around the source code to see for yourself:

ASP.NET MVC 2 RTM on CodePlex

like image 199
Kev Avatar answered Nov 11 '22 14:11

Kev