mardi 18 août 2015

Detect Synchronous and Asynchronous Controller Actions in MVC 4

We recently ran into the issue where ExecuteCore() in BaseController was no longer being called. Worked in MVC 3 but not in MVC 4

So, I added the property protected override bool DisableAsyncSupport to BaseController like so:

protected override bool DisableAsyncSupport
{
    get { return true; }
}

The obvious problem now is what to do when we get an async action? How can I detect if the controller action is synchronous VS asynchronous?

I need something like this, I think:

            protected override bool DisableAsyncSupport
            {
                get
                {
                    if(actionIsSynchronous)
                        return true;
                    else
                        return false

                }
            }

Thanks for helping out!

Aucun commentaire:

Enregistrer un commentaire