動的サイトマップを作成する独自のstaticsitemapproviderを作成しました。私が抱えている問題は、ページのクエリ文字列に無視する必要のある追加のパラメータが含まれる場合があることです。
Public Overrides Function FindSiteMapNode(ByVal rawUrl As String) As SiteMapNode
Dim startpos As Integer = 0
Dim endpos As Integer = 0
If rawUrl.Contains("pagetype=") Then
startpos = rawUrl.IndexOf("pagetype=")
endpos = rawUrl.IndexOf("&", startpos) + 1
If endpos >= startpos Then
'not the last param
rawUrl = rawUrl.Remove(startpos, endpos - startpos)
Else
'must be the last param
rawUrl = rawUrl.Remove(startpos)
End If
End If
Return MyBase.FindSiteMapNode(rawUrl)
End Function
また、HttpContectオブジェクトを取り込むFindSiteMapNode関数をオーバーライドしました。これを使用して、そのリクエストのURLを簡単に見つけて、上記と同じ関数で実行します。
ただし、これを使用すると、(サイトマップにバインドされている)私のサイトマップパスはすべてのページで何も返しません。