내 질문에 대한 답변을 발견하고 나중에 사용할 수 있도록 게시합니다. 일치하는 경로를 조회 할 때 사이트 맵 공급자가 항상 쿼리 문자열 매개 변수없이 경로를 사용하는 것으로 보입니다. 트릭은 오버라이드 된 SiteMapProvider.CurrentNode()
함수에서 Reqest.RawUrl
을 사용하지 않고 Request.Path
을 사용하는 것입니다. 아래에서 내 솔루션을 게시했습니다.
public class CustomSiteMapProvider : SiteMapProvider {
// Implement the CurrentNode property.
public override SiteMapNode CurrentNode {
get {
var currentUrl = FindCurrentUrl();
// Find the SiteMapNode that represents the current page.
var currentNode = FindSiteMapNode(currentUrl);
return currentNode;
}
}
// Get the URL of the currently displayed page.
string FindCurrentUrl() {
try {
// The current HttpContext.
var currentContext = HttpContext.Current;
if (currentContext != null) return currentContext.Request.Path;
throw new Exception("HttpContext.Current is Invalid");
} catch (Exception e) {
throw new NotSupportedException("This provider requires a valid context.", e);
}
}
...