2012-11-26 4 views
0

나는 다음과 같은 조치가있다 :HttpVerbs.Get 및 매개 변수?

http://MyServer/Integration/Feed/MyTest 

하지만 feedKey가 null :

public class IntegrationController : Controller 
    { 
     [AcceptVerbs(HttpVerbs.Get)] 
     public ContentResult Feed(string feedKey) 
     { 
      ... 
     } 
} 

나는이 URL을 사용하려고 노력 해요? 이것은 루트와 관련이 있습니까?

편집 1 :

routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 

      routes.MapRoute(
       "Default", // Route name 
       "{controller}/{action}/{id}", // URL with parameters 
       new { controller = "Ad", action = "List", id = UrlParameter.Optional } // Parameter defaults 
      ); 

      routes.MapRoute(
       "TreeEditing", // Route name 
       "{controller}/{action}/{name}/{id}", // URL with parameters 
       new { controller = "AdCategory", action = "Add", name = string.Empty, id = -1 } 
      ); 

편집 2 :

routes.MapRoute(
       "IntegrationFeed", // Route name 
       "{controller}/{action}/{name}/{feedKey}", // URL with parameters 
       new { controller = "Integration", action = "Feed", name = string.Empty, feedKey = "" } 
      ); 
+0

정의한 경로는 무엇입니까? – jrummell

+0

회신을 통해 업데이트되었습니다. – Ivy

답변

1

은 당신이 경로 feedKey에 대해 정의해야합니까? 기본 경로를 사용하면 다음이 작동합니다 (feedKey에서 id으로 변경).

[AcceptVerbs(HttpVerbs.Get)] 
    public ContentResult Feed(string id) 
    { 
     // ... 
    } 
+0

니스, 고마워요! 새로운 경로를 만드는 것이 어떻게 생겼습니까? – Ivy