Click here to Skip to main content
15,868,019 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
Posted
Updated 13-Sep-18 9:41am
Comments
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

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[^]
 
Share this answer
 
Comments
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900