asp.net mvc 4 - MVC 4 is overwriting specific Action-Parameters -
mvc 4 present me strange behaviour @ moment.
imagine following code:
testcontroller.cs
public class testcontroller : controller { public actionresult index(function function, string action) { return view(); } public class function { public string action { get; set; } } }
it seems, when call url directly through browser (localhost:port/test), action-property gets automatically filled "index". if action named "mysuperduperactionwhichgetsinvokedquiteoften", methodname in property.
can explain mvc doing here? problem is, of course want fill stuff myself, example through ajax-query. if mvc filling in property itself, breaks behaviour.
i could, of course, rename property , working, still quite interesting what's going on.
edit
i understand second parameter, string action, get's filled method-name. why on earth mvc bind any property/parameter named same request-value of it?
it problem default model binder. "maps" request fields properties in class. there article of msdn describing how works situation code this:
action = request["action"] //where of course request["action"] equals name of action
Comments
Post a Comment