Asp.net mvc - single door filter

I need to run a filter method with all string in GET or POST value from http request before it was bound to controller action

Can I do this in Global.asax.cs? and if so can you give me more details or an example (excellent) about this?

+1


source to share


2 answers


You can do this in Global.asax.cs for all requests

protected void Application_BeginRequest(object sender, EventArgs e) {
   //Look at HttpContext.Current.Request to grab request values 
}

      



Model binding occurs before the action filters are run. If you want to write a filter that runs before binding to the model, you can write an IAuthorizationFilter file that runs before binding to the model.

+3


source


I believe you can use an action filter.



Try article .

+1


source







All Articles