By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,351 Members | 1,295 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,351 IT Pros & Developers. It's quick & easy.

Exception using sitemap class

P: n/a
I am writing a custom control (code see below) and I am getting an
exception that drives me crazy.

When I drag my control on a form, Visual Studio shows immediately the
following exception:

"Error Rendering Control - NiftyMenu1 An unhandled exception has
occurred. The provider 'AspNetXmlSiteMapProvider' specified for the
defaultProvider does not exist in the providers collection."

What does that mean exactly? For debugging purpoes I list my providers
with the following code:

<%@ Page Language="C#" %>
"-//W3C//DTD XHTML 1.0 Transitional//EN"

<SCRIPT runat="server"&gt;
private void Page_Load(object sender, System.EventArgs e)

IEnumerator providers = SiteMap.Providers.GetEnumerator();
while (providers.MoveNext())

I am getting the output: System.Web.XmlSiteMapProvider

So I think it should find it. Or is it System.Web.XmlSiteMapProvider
different to AspNetXmlSiteMapProvider?

What am I missing? Must be something obvious but I can't see it.

Any help is very much appreciated.

Here is the code of my control:

1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Text;
5 using System.Web;
6 using System.Web.UI;
7 using System.Web.UI.WebControls;
9 namespace MyControls
10 {
11 [ToolboxData("&lt;{0}:NiftyMenu
12 public class NiftyMenu : WebControl
13 {
14 protected override void RenderContents(HtmlTextWriter
15 {
16 RenderMasterMenu(output);
17 }
19 protected virtual void RenderMasterMenu(HtmlTextWriter
20 {
21 output.Write("&lt;ul id=\"nav\"&gt;");
22 // The following line produces the exception
23 SiteMapNode node = SiteMap.CurrentNode;
24 }
25 }
26 }

The offending line is #23. If I comment that out the exception is
gone. But I need the SiteMap class!

Oct 27 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.