开发者

Doesn't ASP.Net MVC Differentiate URLs on number of arguments?

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?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜