은 내가 내 MVC 응용 프로그램에서이 프로파일 컨트롤러에이 주소 www.exmaple.com/my-profile을 라우팅하고 싶은 www.example.com/my-profile을 다시 라우팅합니다. 당신이 기본 라우팅 Asp.net MVC 2는 어떻게
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}/", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
이
은지도 노선 내가routes.MapRoute(
"Profile", // Route name
"{profile_name}/", // URL with parameters
new { controller = "Portfolio", action = "Index", page = UrlParameter.Optional } // Parameter defaults
);
을 www.exmaple.com/my-profile을 라우팅하는 데 사용하기 위해 노력하고있어입니다 수있는 내 global.aspx가있다
문제는 내가 입력 한 www.exmaple.com/profile을 입력하면 내가 지정한 maproute가 아니라 기본 maproute로 안내합니다.
하지만 난이 www.example.com/profile/my-profile
routes.MapRouteLowercase(
"Profile", // Route name
"profile/{profile_name}/", // URL with parameters
new { controller = "Portfolio", action = "Index", page = UrlParameter.Optional } // Parameter defaults
);
가 잘 작동하지만 난 내 프로필 전에 프로필을 추가 할 해달라고 할 수 있습니다 때. facebook.com/my-profile 또는 youtube.com/my-profile처럼 일하고 싶습니다.
사람 하나가, 내가 (오프와)
감사
을 2 개월 이상에 대한 해결책을 찾고있다 내가이를 알고 있나요
안녕하세요, 나는 주위를 전환 해 보았지만 결코 효과가 없었습니다. "{**}/{**} /"패턴을 따르는 모든 URL을 내 프로필 페이지로 라우팅하려고했습니다. – user439525