Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SiteMap.FindSiteMapNodeFromUrl gives infinite loop when no node and embedded in an aspx page #366

Closed
MikeWalsh opened this issue Oct 21, 2014 · 2 comments

Comments

@MikeWalsh
Copy link

This might be a bit of an edge case here but after updating to v4.6.15
In older parts of the site we are rendering the sitemap using a mvc partial embedded in an aspx page.
We have very large quantities of non-public accessible urls so don't want to create nodes for each.
When SiteMap.FindSiteMapNodeFromUrl is called on a url that doesn't exist in the sitemap line 747 gives

string clientQueryString = currentHandler.ClientQueryString;
if (clientQueryString.Length > 0)
{
    node = this.FindSiteMapNode(relativePath + "?" + clientQueryString);
}

This call to FindSiteMapNode then calls FindSiteMapNodeFromUrl again which ends up in a stack overflow.
I changed that code to

string clientQueryString = currentHandler.ClientQueryString;
if (clientQueryString.Length > 0)
{
    string newSearchTerm = relativePath + "?" + clientQueryString;
    // avoid infinite loops
    if (newSearchTerm != relativeUrl)
    {
        node = this.FindSiteMapNode(newSearchTerm);
    }
}

and all seems to be well again

@NightOwl888
Copy link
Collaborator

Thanks for the report. Your solution just makes an unreachable execution path, effectively cancelling the find operation when using an ASP.NET page. I have created a fix that I believe will work in v4.6.17, but I was unable to test it because I was unable to reproduce the issue. Please confirm that this patch works and/or provide a way to reproduce this scenario.

@MikeWalsh
Copy link
Author

Yep, that seems to work fine. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants