views:

41

answers:

2

Somehow I had the impression that ASP.Net differentiates URLs based on the number of arguments too. But it doesn't seem to work in my project.

Consider the following function prototypes

public PartialViewResult GetMorePosts(string param1, string param2, string param3, int param4, int param5) AND public PartialViewResult GetMorePosts(string param1, string param2, string param3, int param4)

I thought if my URL had one extra argument it should resolve to the second function... Instead I am getting an ambiguous URL error.

Why?

+1  A: 

You need to make sure that the route table has the url wit the least arguments first, otherwise the one with more arguments will hide the rest.

Mark Dickinson
That's right. However my routes were set up correctly, the problem was in one of the parameter names. I could locate and fix the issue later. Thanks for the answer.
Cyril Gupta
Glad you managed to fix it :)
Mark Dickinson
A: 

ASP.NET MVC doesn't support action method overloading based on method signature. For a discussion of this and workarounds, see this post.

Levi