views:

39

answers:

1

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.

+2  A: 

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

Kev