views:

38

answers:

1

Hi all,

I'm making a request that I thought would be caught by my route, but there is no match. What am I doing wrong?

Any comments appreciated, Anders, Denmark

--

Url :

EventReponse/ComingAdmin/386/01e71c45-cb67-4711-a51f-df5fcb54bb8b

Expected match:

        routes.MapRoute(
            "Editing event responses for other user", // Route name
            "EventResponse/{action}/{eventId}/{userId}", // URL with parameters
            new {controller = "EventResponse", action = "ComingAdmin"} // Parameter defaults
            );

Desired controller (but I guess this does not come into play):

public class EventResponseController : ControllerBase
{
    (...)
    public ActionResult ComingAdmin(int eventId, Guid userId)
    {
        return RegisterEventResponse(eventId, AttendanceStatus.Coming, userId);
    }
}
+3  A: 

Your userId is not between curly braces

routes.MapRoute(
        "Editing event responses for other user", // Route name
        "EventResponse/{action}/{eventId}/{userId}", // URL with parameters
        new {controller = "EventResponse", action = "ComingAdmin"} // Parameter defaults
       );

And your Url mentions EventReponse instead of EventRe s ponse so it should be:

EventResponse/ComingAdmin/386/01e71c45-cb67-4711-a51f-df5fcb54bb8b

It's all in the details :-)

Thomas
Good call - and fast!Alas it did not solve the problem (in itself).
Anders Juul
I updated the answer, it should work now.
Thomas
Fantastic - so it wasn't black voodoo after all! Thanks and have a nice day!
Anders Juul