配置 ASP.NET 站点地图 URL 域
我有一个这样配置的站点地图:
<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
由于某种原因,即使在站点地图中,网址也定义为“www.website.com/index.aspx”或“home.aspx”。 aspx”,currentNode.URL 总是将域附加到 URL,创建错误的 url,如“www.domain.com/www.website.com/index.aspx”
我试图找出 www.domain.com 在哪里来自我的项目和 web.config 文件中的搜索,但我似乎找不到它。
有什么想法或建议吗?
I have a site map configured as such:
<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"/>
I have a custom breadcrumb function that looks like this:
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
For some reason, even though in the sitemap, the url is defined as "www.website.com/index.aspx" or "home.aspx", the currentNode.URL always has the domain attached to the URL, creating bad urls like "www.domain.com/www.website.com/index.aspx"
I've tried to figure out where www.domain.com was coming from by search my project and inside of my web.config file, but I can't seem to find it.
Any ideas or suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了原因。
该域是在 web.config 文件内的
子目录下配置的,因为应用程序托管在虚拟目录内。两者的结合就是 sitenode 创建 url 的方式。
I found the reason why.
The domain was configured inside of the web.config file, under
The subdirectory was due to the fact that the application was hosted inside of a virtual directory. The combination of the two is how the sitenode created the urls.