I am trying to have two different methods for account registration in my Asp.net MVC application, one for general users to register for and another for users who are registering with a specific registration token. Thus I have the following method signatures in my AccountController:
public virtual ActionResult Register () {...}
public virtual ActionResult Register (Guid registrationToken) {...}
However, when I go to http://localhost/Account/Register I get an exception that the current request is ambiguous between these two actions. I was under the impression that it would use the parameterless Register action if there was no registrationToken GET parameter passed in, otherwise it would use the 2nd.
Does this require special route configuration?
Would it be easier to have one method with a nullable parameter? This will also automatically solve your problem as it will not be ambiguous anymore: