开发者

Configuring ASP.NET Site Map URL Domain

开发者 https://www.devze.com 2023-01-01 19:44 出处:网络
I have a site map configured as such: <siteMap xmlns=\"http://schemas.microsoft.com/AspNet/SiteMap-File-1.0\" >

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
        c开发者_JS百科urrentNode = 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

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?


I found the reason why.

The domain was configured inside of the web.config file, under

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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消