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()
        // 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=, 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=, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXXXXXX" %>

And Finally i set the Tag in my Masterpage:

   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?


  • 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

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy