none
Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe

    Question

  • Hi Friends,

    Getting this web part error when i am opening my web app. "Web Part Error: A Web Part or Web Form Control this Page cannot be displayed or imported. The type could not be found or it is not registered as safe". my concern is how can find i find Assembly Name, version , pb key token for this specific web part as i didn't create this web part. so my app is working fine except this webpart. i checked web.config file but i don't know whether it exist or not into safe control?

    Thanks in advance



    Wednesday, December 19, 2012 3:59 PM

Answers

  • Open the DWP in notepad and you should see a line of text between <Assembly></Assembly> tahe that value and then put it in the web.config like this:

    <SafeControls>

    <SafeControl Assembly="ASSEMBLY" Namespace="NAMESPACELISTEDINASSEMBLY" TypeName="*" Safe="True" AllowRemoteDesigner="True"/>

    For the namespace it's available under typename, but isn't the full type name. For example 'Microsoft.SharePoint.WebPartPages.ContentEditorWebPart' would be a namespace of 'Microsoft.SharePoint.WebPartPages'. Pretty much just remove the text after the last period.


    My CodePlex - My Blog - My Twitter

    • Marked as answer by rakib1 Thursday, December 20, 2012 5:38 PM
    Wednesday, December 19, 2012 7:24 PM

All replies

  • You need to register your assembly as a safe control in the web.config file, This is ideally done by wsp . In case if its not happening The easiest way is deploy the wsp, the name of the wsp ideally will be the name of the dll( or the project name) which you can find in GAC (windows assembly)(if you have not changed it specifically). Right click on the dll you will get properties you need and register it to web.config.

    <SafeControl Assembly="MyWebPartLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Namespace="MyWebPartLibrary" TypeName="*" Safe="True" AllowRemoteDesigner="True"/>

    FYi: http://msdn.microsoft.com/en-us/library/ms581321(v=office.12).aspx


    Raghavendra Shanbhag | Blog: www.SharePointColumn.com
    Please click "Propose As Answer " if a post solves your problem or "Vote As Helpful" if a post has been useful to you.
    Disclaimer: This posting is provided "AS IS" with no warranties.


    Wednesday, December 19, 2012 4:07 PM
  • hi,

    Thanks for ur reply. still having same problem. i got the webpartname.dwp but is there any way i can retrieve assembly from this dwp file. Actually checked gac but don't know adjactly which one.

    Thanks

    Wednesday, December 19, 2012 4:44 PM
  • You can get this from TypeName,Assembly,Type  from the dwp file. check this link

    http://www.microstrategy.com/producthelp/9.3/Portalhelp/topics/SharePoint/ShP_Configuring_Settings_Using_DWP_Files.htm

    http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/08/21/the-difference-between-dwp-and-webpart.aspx


    Raghavendra Shanbhag | Blog: www.SharePointColumn.com
    Please click "Propose As Answer " if a post solves your problem or "Vote As Helpful" if a post has been useful to you.
    Disclaimer: This posting is provided "AS IS" with no warranties.

    Wednesday, December 19, 2012 5:25 PM
  • Still having same problem. My scenario is i have a web application and deployed all packages to work with it. Everything is working fine in web application except DateFilter web part "Web Part Error: A Web Part or Web Form Control this Page cannot be displayed or imported". i know its because of safe control but dont know how can i get assembly information as i deployed just wsp. In web part gallery i can see my DateFilterwebpart.dwp. Using ULS viewer but dont have idea how can i find my specific web part assembly information.

    Any help will be appreciated.


    • Edited by rakib1 Wednesday, December 19, 2012 6:45 PM
    Wednesday, December 19, 2012 6:27 PM
  • Open the DWP in notepad and you should see a line of text between <Assembly></Assembly> tahe that value and then put it in the web.config like this:

    <SafeControls>

    <SafeControl Assembly="ASSEMBLY" Namespace="NAMESPACELISTEDINASSEMBLY" TypeName="*" Safe="True" AllowRemoteDesigner="True"/>

    For the namespace it's available under typename, but isn't the full type name. For example 'Microsoft.SharePoint.WebPartPages.ContentEditorWebPart' would be a namespace of 'Microsoft.SharePoint.WebPartPages'. Pretty much just remove the text after the last period.


    My CodePlex - My Blog - My Twitter

    • Marked as answer by rakib1 Thursday, December 20, 2012 5:38 PM
    Wednesday, December 19, 2012 7:24 PM