Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

i have a big problem with a custom .NET Menu Control. I created a Solution with following class:

namespace MyControl {

  public class SiteMapPath : System.Web.UI.WebControls.SiteMapPath 
  {
     protected override void CreateControlHierarchy()
     {
        base.CreateControlHierarchy();
        // Here i want place some custom code
     }
  }

}

So the next step i did was to deploy this as farm solution and set the safecontrol in web.config:

<SafeControl Assembly="MyControl, Version=1.0.0.0, Culture=neutral, PublicToken=XXXXXXXXXXXXXXXXXXXXX" Namespace="MyControl" TypeName="*" Safe="true" />

Then i registered the Control in my Masterpage:

<%@ Register Tagprefix="MyControl" Namespace="MyControl" Assembly="MyControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXXXXXX" %>

And Finally i set the Tag in my Masterpage:

<MyControl:SiteMapPath
   runat="server"
   SiteMapProviders="SPSiteMapProvider,SPXmlContentMapProvider"
   RenderCurrentNodeAsLink="false"
   NodeStyle-CssClass="breadcrumbNode"
   CurrentNodeStyle-CssClass="breadcrumbCurrentNode"
   RootNodeStyle-CssClass="breadcrumbRootNode"
   HideInteriorRootNodes="true"
   SkipLinkText=""
   PathSeparator="|" />

When i know go to my Website i got this Error Message:

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: The control type 'MyControl.SiteMapPath' is not allowed on this page. The type is not registered as safe.

Source Error:
Line 521: <div id="clickPath">
Line 522:  <MyControl:SiteMapPath
Line 523:    runat="server"
Line 524:    SiteMapProviders="SPSiteMapProvider,SPXmlContentMapProvider"

What do i wrong? Or can it be that i can not extend the ASP .NET controls, because they don't implement the Microsoft.SharePoint.WebControls.SPControl? Is there any way or a workaround?

thx.

share|improve this question
    
Did you do an IISRESET after deploying the solution and setting the SafeControl? –  James Love Mar 22 '11 at 17:29
    
Also, SiteMapPath is not sealed. You'd have had a compile time error if it was, therefore you can indeed extend it. –  James Love Mar 22 '11 at 17:30
    
Yes i did a IISRESET with no effect the error is still there. But i also don't find any examples how to implement a custom ASP .NET control in SharePoint. I also tried to extend from SPControl, ListSiteMapPath... i got everytime this error ?_? With IISRESET. –  user1716 Mar 23 '11 at 8:29
add comment

1 Answer

up vote 0 down vote accepted

Ok i solved the Problem, it seems my Server was not installed correct. After a new freh installation, the Problem was solved!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.