0

My web.sitemap should match any query string. If my data query string is having 100 entries then that would require one hundred site map file entries. Is there any short cut method to do this ?

Like-

  <siteMapNode url="allvideo.aspx?data=Dancing" title="Dancing" >

        <siteMapNode url="alonevideo.aspx?data=*&amp;selected=*" title="abc" />
      </siteMapNode>
  <siteMapNode url="allvideo.aspx?data=Acting" title="" >
        <siteMapNode url="alonevideo.aspx?data=*&amp;selected=*" title="xyz" />
      </siteMapNode>

asterisk is not working any other wildcard or regex to do this

Jack Stern
  • 395
  • 1
  • 4
  • 16
  • Shouldn't your site map contain all URLs you want to be accessible directly by browsing the site map? It doesn't need to include all valid URLs, but only the ones you decide to publish. It doesn't therefore make any sense to have entries with wildcards, because these aren't valid URLs. – Lorenz Meyer Mar 07 '15 at 08:13
  • @LorenzMeyer - See my answer [here](http://stackoverflow.com/questions/28832178/asp-net-sitemap-how-important/28836403#28836403) for a disambiguation of the term "site map". Jack is referring to the ASP.NET navigation framework, not the search engine XML sitemap. – NightOwl888 Mar 07 '15 at 08:30
  • @night thanks for the explanation. I was not aware of this. – Lorenz Meyer Mar 07 '15 at 09:08

1 Answers1

-1

The implementation of SiteMapProvider first attempts to match the URL with the query string, then attempts to match the URL without the query string. So, to match any query string, you just need to leave it off of your <siteMapNode> url attribute.

<siteMapNode url="allvideo.aspx?data=Dancing" title="Dancing" >
    <siteMapNode url="alonevideo.aspx" title="abc" />
</siteMapNode>
NightOwl888
  • 55,572
  • 24
  • 139
  • 212
  • You are correct. But I need alonevideo node for different pages with different titles. So I need a way to match unkown query strings. – Jack Stern Mar 08 '15 at 08:59
  • 1
    As per MSDN, you can [programmatically change nodes in memory](https://msdn.microsoft.com/en-us/library/ms178425%28v=vs.140%29.aspx). The example shows modification of the URL, but you could also modify the title. – NightOwl888 Mar 08 '15 at 09:09