468,117 Members | 1,461 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,117 developers. It's quick & easy.

Exception using sitemap class

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
0 2520

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Andy Sutorius via DotNetMonster.com | last post: by
1 post views Thread by mike | last post: by
2 posts views Thread by mike | last post: by
4 posts views Thread by shapper | last post: by
reply views Thread by dirk | last post: by
5 posts views Thread by Tim Mackey | last post: by
reply views Thread by Chris | last post: by
13 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.