2010-05-17 6 views
0

나는 내 길에 걸릴 것이라고 생각하는 요청을하고 있지만 일치하는 것은 없습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?MVC 라우팅 - 왜 내 요청이 경로와 일치하지 않습니까?

모든 의견은 앤더스, 덴마크

감사 -

URL :

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

예상 경기 :

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

원하는 컨트롤러 (하지만이하지 않는 것 같아요 플레이 시작) :

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

답변

3

사용자 ID는 중괄호

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

사이되지 않습니다 그리고 그것이 있어야 귀하의 URL 대신 EventRe ponse의 EventReponse을 언급 :

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

그것은 세부 사항에있는 모든입니다 : -)

+0

통화가 빠르고 빠릅니다! 아쉽게도 문제를 해결하지 못했습니다 (자체적으로). –

+0

답변이 업데이트되었으므로 지금 작동합니다. – Thomas

+0

환상적 - 결국 검은 부두가 아니 었습니다! 감사합니다. 좋은 하루 되세요! –

관련 문제