We are getting, the type or namespace name 'GlobalFilterCollection' that could not be found (are you missing a using directive or an assembly reference?) in the WEB API project. Please help me.
I think you can use nuget packet Microsoft.AspNet.Mvc
version 4+ Looks like you have the wrong version of MVC DLLs referenced. It should be something like 4.0.xxxx.x.
It is - System.Web.Mvc
With MVC4 now filters are moved out of Global.asax
file and they are located under - App_start\FilterConfig.cs
Like -
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.