0

私はそのように構成されたサイトマップを持っています:

<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>" & "&nbsp;&gt;&nbsp;" & 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 がどこから来ているのかを突き止めようとしましたが、見つからないようです。

アイデアや提案はありますか?

4

1 に答える 1

0

その理由がわかりました。

ドメインは web.config ファイル内で構成されました。

    <appSettings>
    <add key="domain" value="www.domain.com" />
    </appSettings>

サブディレクトリは、アプリケーションが仮想ディレクトリ内でホストされていたためです。2 つの組み合わせは、sitenode が URL を作成した方法です。

于 2010-06-03T12:53:29.277 に答える