我有一个这样配置的站点地图:
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="www.website.com/index.aspx" title="Site Name" description="">
<siteMapNode url="home.aspx" title="My Home" description="My Home" Group="Active">
<siteMapNode url="Search.aspx" title="Search" description="Search For Roommate" Group="Active">
<siteMapNode url="SearchResults.aspx" title="Search Results" description="Roommate Search Results" Group="Active"/>
</siteMapNode>
<siteMapNode url="Extend.aspx" title="Extend Account" description="Extend Account" Group="Active"/>
<siteMapNode url="Hotlist.aspx" title="Hotlist" description="Hotlist" Group="Active"/>
我有一个自定义面包屑功能,如下所示:
Public Shared Function SitePath(ByVal tr As String, Optional ByVal type As String = "REG") As String
If SiteMap.Providers(type).CurrentNode IsNot Nothing And SiteMap.Providers(type).CurrentNode IsNot SiteMap.Providers(type).RootNode Then
Dim currentNode As SiteMapNode
currentNode = SiteMap.Providers(type).CurrentNode
Dim path As String = currentNode.Title
Dim str As String = ""
Do
currentNode = currentNode.ParentNode
path = "<a href=""" & shsutils.generateURLSecure(currentNode.Url, tr & str) & """>" & currentNode.Title & "</a>" & " > " & path
Loop While currentNode IsNot SiteMap.Providers(type).RootNode
SitePath = path
Exit Function
End If
SitePath = ""
End Function
出于某种原因,即使在站点地图中,url 被定义为“www.website.com/index.aspx”或“home.aspx”,currentNode.URL 总是将域附加到 URL,从而创建错误的 url,例如“www.domain.com/www.website.com/index.aspx”
我试图通过搜索我的项目和我的 web.config 文件来找出 www.domain.com 的来源,但我似乎找不到它。
有什么想法或建议吗?