ASP.NETサイトマップURLドメインの構成
-
23-10-2019 - |
質問
そのように構成されたサイトマップがあります:
<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
何らかの理由で、SiteMapでは、URLは「www.website.com/index.aspx」または「home.aspx」として定義されていますが、currentNode.urlは常にURLにドメインを接続し、バッドURLを作成します。 「www.domain.com/www.website.com/index.aspx」
www.domain.comが私のプロジェクトを検索し、Web.configファイルの内部からどこから来ているのかを把握しようとしましたが、それを見つけることができないようです。
何かアイデアや提案はありますか?
解決
理由を見つけました。
ドメインは、web.configファイルの内部で構成されていました。
<appSettings>
<add key="domain" value="www.domain.com" />
</appSettings>
サブディレクトリは、アプリケーションが仮想ディレクトリ内でホストされているという事実によるものでした。 2つの組み合わせは、サイトノードがURLを作成する方法です。
所属していません StackOverflow