3 ms·
You can't have functions with the same parameters, but ASP.NET MVC gives you a way around this using attributes. See this SO question. http://goo.gl/wJ4jE http:
by rodh257 15y ago
You can't have functions with the same parameters, but ASP.NET MVC gives you a way around this using attributes. See this SO question. http://goo.gl/wJ4jE http://goo.gl/wJ4jE
Does that solve what you were talking about?
- sk5t 15y agoSeconded - grandparent post is way off with regard to ASP.NET MVC. See all the concrete classes of ActionMethodSelectorAttribute.
- rjd 15y agoMan you're a life saver, I spent an entire afternoon researching this, and finally gave up after dozens of blogs said it was impossible. Infact an article on stack overflow explained the whole situation as impossible so I gave up researching and wrote my own dispatcher.
- darylteo 15y agoYou can also use [HttpGet], [HttpDelete], [HttpPost], [HttpGet] attributes. Personal preference.
- rodh257 15y agoyeah but the problem he is having is that you'd need to have different a different method signature for each of these otherwise it won't compile, and he wants to have the same path/parameters for each, which is why you need to rename your method and then add the different attribute. If your methods already have different parameters or a different name, you can just use the attributes like you state.
- rjd 15y agoOK thanks once again, got it work. Decided to keep using my previous dispatcher to handle webdav verbs, plus I've already written exception handlers and stuff. Great result for me :)