Getting the Action during model binding

Posted by Kieron on Stack Overflow See other posts from Stack Overflow or by Kieron
Published on 2010-08-13T10:19:48Z Indexed on 2010/12/23 7:54 UTC
Read the original article Hit count: 406

Hi,

Is there a way of getting the Action, and reading any attributes, during the model binding phase?

The scenario is this:

I've got a default model binder set-up for a certain data-type, but depending on how it's being used (which is controlled via an attribute on the action) I need to ignore a set of data.

I can use the RouteData on the controller context and see the action name, which I can use to go get the data, but wondered if that information is already available.

Additionally, if the action in question is an asynchronous one, they'd be more processing involved in looking it up...

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about c#-4.0