반응형
앵커가있는 ASP.Net MVC RedirectToAction
다음과 같은 문제가 있습니다. 예를 들어 다음과 같은 경로가 있습니다.
routes.Add(new Route("forums/thread/{threadOid}/last", new MvcRouteHandler())
Defaults = new RouteValueDictionary(
new { controller = "Thread", action ="ShowThreadLastPostPage"}),
Constraints = new RouteValueDictionary(new { threadOid = @"^\d+$" })
}
);
RedirectToAction 메서드를 사용하여 다음과 같은 URL로 이동하는 방법이 있습니까?
forums/thread/{threadOid}/last#postOid
나는 당신이 그것을 달성 하기 위해 Redirect
방법과 함께 사용해야한다고 생각 Url.RouteUrl
합니다.
return Redirect(Url.RouteUrl(new { controller = "Thread", action = "ShowThreadLastPostPage", threadOid = threadId }) + "#" + postOid);
다른 대안 Url.Action
:
return Redirect(Url.Action("ShowThreadLastPostPage", "Thread", new { threadOid = threadOid }) + "last#" + postOid);
참고 URL : https://stackoverflow.com/questions/602788/asp-net-mvc-redirecttoaction-with-anchor
반응형
'development' 카테고리의 다른 글
postgresql에서 변수 값 인쇄 (0) | 2020.10.07 |
---|---|
탐색 창 반투명 상태 표시 줄이 작동하지 않음 (0) | 2020.10.07 |
여러 키로 사전 목록을 정렬하는 Python (0) | 2020.10.07 |
파이썬 목록 조각에서 할당은 어떻게 작동합니까? (0) | 2020.10.07 |
ORA-01950 : 겉 (표) 영역 'USERS'에 대한 특권이 없습니다 (0) | 2020.10.07 |