I'm trying to register a filter in a simple mvc application. I haven't even really written anything yet outside of the basic filter to test with. I'm using VS 2015 RC and I created the initial application by going to new project -> Asp.net Web Application -> Web API. The problem I'm having is that I can't find a way to register the filter globally.
From earlier versions of MVC I see the GlobalFilters.Filters
, but when I try to use that in the new framework it tells me that GlobalFilters can't be found. In previous versions it lived in System.Web.MVC, but I no longer see that in my references, and I can't seem to find it anywhere.
This seems like it should be very simple but so far I haven't found a way to do it.
Here's my project.json
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-beta4",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta4"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
},
"frameworks": {
"dnx451": {
"frameworkAssemblies": {
}
},
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
]
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…