A Web Part or Web Form Control on this Page cannot be displayed or imported. The type YourNameSpace.YourPart, YourPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=SomeToken could not be found or it is not registered as safe.



Hi Friends,

Its over a year since we met each other. I am back guys. Lets start the post. This time i am going to describe one stupid error in SharePoint web part deployment. The developer came to me today with a issue .

A Web Part or Web Form Control on this Page cannot be displayed or imported. The type YourNameSpace.YourPart, YourPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=SomeToken could not be found or it is not registered as safe.


When you closely see , error itself shows some assembly is not added in safe control list. This is an unusal behaviour. When you deploy any solution , SharePoint does take care about adding safe control values in web.config. But what goes wrong here?? Web Part namespace was diffrent than specified in solution. It mayy possible that code is taken from some one or copied from another location

If you have a web part, you will have a .webpart file. Open it up. You will want to ensure that the type name references your namespace and type used for your particular web part that it references. Check within the metaData field. Here’s an example of my working .webpart file:

<metaData>
      <type name="Myblog.WebParts.MyWebPart, $SharePoint.Project.AssemblyFullName$" />
      <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
    </metaData>

These files must reference the namespace included with the type


I did my best to cover every base for this issue. If anyone finds a location I may have missed that would contribute towards this problem please post! Did this help? Let me know!


Comments

Popular posts from this blog

Messages stuck in drafts: Exchange 2013 issue

Top 7 Technical Support Best practices to ensure the positive customer experience

Application compatibility update for Windows 7- KB2791765