<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Master Pages, Themes and Navigation Controls</title><link>http://forums.asp.net/139.aspx</link><description>Discussions of MasterPages, Themes, and other page-related features. &lt;A href="http://aspadvice.com/SignUp/list.aspx?l=164&amp;amp;c=30" target=_blank&gt;Email List&lt;/A&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: SiteMapResolve event, global.asax and defaultProvider</title><link>http://forums.asp.net/thread/1971660.aspx</link><pubDate>Wed, 24 Oct 2007 15:34:04 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1971660</guid><dc:creator>msalamon</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1971660.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=139&amp;PostID=1971660</wfw:commentRss><description>&lt;p&gt;Oops.&amp;nbsp; I have answered my own question.&amp;nbsp; In the Handle() method I was getting the currentNode from the SiteMap object (the default one), not from the custom provider.&amp;nbsp; once I changed that, it worked fine.&lt;/p&gt;</description></item><item><title>Re: SiteMapResolve event, global.asax and defaultProvider</title><link>http://forums.asp.net/thread/1970052.aspx</link><pubDate>Tue, 23 Oct 2007 21:22:18 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1970052</guid><dc:creator>msalamon</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1970052.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=139&amp;PostID=1970052</wfw:commentRss><description>&lt;p&gt;Thanks.&amp;nbsp; I now understand what I was doing wrong.&amp;nbsp; However, I am still having some problems, likely in part b/c this is part of sharepoint.&amp;nbsp; My web.config looked like this, with the custom provider set as the default:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;siteMap defaultProvider=&amp;quot;&lt;strong&gt;CustomProvider&lt;/strong&gt;&amp;quot; enabled=&amp;quot;true&amp;quot;&amp;gt; &amp;lt;!-- CurrentNavSiteMapProvider&amp;nbsp;&amp;nbsp; --&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;providers&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;add name=&amp;quot;CustomProvider&amp;quot; siteMapFile=&amp;quot;_app_bin/xyz.sitemap&amp;quot; type=&amp;quot;System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&amp;quot;/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;add name=&amp;quot;CurrentNavSiteMapProvider&amp;quot; description=&amp;quot;CMS provider for Current navigation&amp;quot; type=&amp;quot;Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&amp;quot; NavigationType=&amp;quot;Current&amp;quot; EncodeOutput=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/providers&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/siteMap&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I changed my code in global.asax to this:&lt;/p&gt;
&lt;p&gt;SiteMapProvider customSiteMapProvider = SiteMap.Providers[&amp;quot;CustomProvider&amp;quot;];&lt;br /&gt;customSiteMapProvider.SiteMapResolve += new SiteMapResolveEventHandler(Handle); &lt;/p&gt;
&lt;p&gt;It all works fine.&amp;nbsp; but if I change my default provider to CurrentNavSiteMapProvider, then my global.asax throws this exception in the Handle() code:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; System.InvalidCastException: Unable to cast object of type &amp;#39;System.Web.SiteMapNode&amp;#39; to type &amp;#39;Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode&amp;#39;.&lt;/p&gt;
&lt;p&gt;I put some&amp;nbsp;logging code inside&amp;nbsp;my Handle method:&lt;/p&gt;
&lt;p&gt;SiteMapNode currentNode = SiteMap.CurrentNode;&amp;nbsp;&lt;br /&gt;HttpContext.Current.Trace.Write(&amp;quot;SiteMapProvider = &amp;quot; + currentNode.Provider.Name);&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;The site map provider that is always listed is the default sitemapprovider, regardless of which sitemapprovider i attached the event handler to.&lt;/p&gt;
&lt;p&gt;Just added some more logging and found out something interesting.&amp;nbsp; currentNode.Provider.Name yields the default provider, but e.Provider (from SiteMapResolveEventArgs e)&amp;nbsp;yields the custom provider.&amp;nbsp; Not sure what this means....&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thus, it appears as if the event handling code is still attached to the default (sharepoint) provider.&amp;nbsp; Any ideas?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thanks&lt;/p&gt;</description></item><item><title>Re: SiteMapResolve event, global.asax and defaultProvider</title><link>http://forums.asp.net/thread/1969796.aspx</link><pubDate>Tue, 23 Oct 2007 18:22:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1969796</guid><dc:creator>RichardD</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1969796.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=139&amp;PostID=1969796</wfw:commentRss><description>You need to add the event handler to all of the providers, not just the default provider:&amp;nbsp;&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;foreach&lt;/span&gt; (SiteMapProvider provider &lt;span class="kwd"&gt;in&lt;/span&gt; SiteMap.Providers)
{
    provider.SiteMapResolve += CustomSiteMapHandler.Handle;
}&lt;/pre&gt;&amp;nbsp;&lt;br /&gt;</description></item><item><title>SiteMapResolve event, global.asax and defaultProvider</title><link>http://forums.asp.net/thread/1969622.aspx</link><pubDate>Tue, 23 Oct 2007 16:36:37 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1969622</guid><dc:creator>msalamon</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1969622.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=139&amp;PostID=1969622</wfw:commentRss><description>&lt;p&gt;I am&amp;nbsp;adding some custom behavior to the display of breadcrumbs. I had read many articles about adding an event handler in the global.axax Application_Start method to do this, as follows:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;SiteMap.Provider.SiteMapResolve += new SiteMapResolveEventHandler(CustomSiteMapHandler.Handle);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;(I have separately created the CustomSiteMapHandler class, but I could have done this within global.asax.)&lt;/p&gt;
&lt;p&gt;I have gotten this to work perfectly, provided that the asp:SiteMapPath tag&amp;nbsp;I am using to render the breadcrumbs&amp;nbsp;references the &lt;strong&gt;default&lt;/strong&gt; sitemap provider.&amp;nbsp; If it references any other provider listed in web.config, however, then the event handling code is skipped entirely.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Can anyone confirm that the event handling only works with the default sitemap provider.&amp;nbsp; If this is not the case, can anyone show me how to have the event handling code work with a non-default provider.&lt;/p&gt;</description></item></channel></rss>