Click here to Skip to main content
14,383,961 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have created one MVC filter.
Right now it is working fine as I have added synchronous code in filter.
Can we make asynchronous method call from filter?

What I have tried:

I have tried with async code but code will go in deadlock mode.
Updated 13-Sep-18 10:41am
Matias Lopez 12-Sep-18 10:52am
chandraprakashkabra 13-Sep-18 11:41am
This blog contains async method in normal like controller, But I am asking about async in specific to Custom Filter which we created.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

There is no reliable way to make async calls from filters in MVC4 or MVC5.

However, depending on your requirements, you might be able to use a module to load the relevant data:
Solutions For Async/Await In MVC Action Filters - Evan Dontje[^]
chandraprakashkabra 14-Sep-18 1:55am
I read the same artical and after that I decided to use sync call instead of async call.
Thanks Richard Deeming.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100