2011-04-18 6 views
1

RemoveAttribute를 구성하여이 경로와 함께 작동하도록 설정하는 방법은 무엇입니까? ASP.NET MVC RemoteAttribute : 원격 유효성 검사를위한 URL을 찾을 수 없습니다.

context.MapExtendedRoute("ValidateSomething", 
           "some-where/validate/{propName}", 
           new { Controller = "SomeWhere", Action = "ValidateSomeRouteKey" }); 

I가 RemoteAttribute 생성자 경로 이름 위에 통과

, InvalidOperationException 발생한다. 그러나 쿼리 정의로 전달 된 경로 정의와 매개 변수에 propName이없는 경우와 마찬가지로 작동합니다. 사전에

덕분에)

답변

1

당신은 당신의 컨트롤러에 액세스 할 수 있도록 경로에 {PROPNAME} 매개 변수를 추가해야합니다. 아래 예제에서 나는 그것을 선택적으로 만들었다.

context.MapExtendedRoute("ValidateSomething", 
          "some-where/validate/{propName}", 
          new { Controller = "SomeWhere", Action = "ValidateSomeRouteKey", propName = UrlParamter.Optional }); 
+0

아니요, 질문하기 전에 테스트했습니다;) – Sadegh

+0

허, RemoteAttribute에게이 작업을 수행하는 방법은 무엇입니까? – Sadegh

관련 문제