locked
Problem loading Web Part RRS feed

  • Question

  • I am trying to load a webpart based on the How To: Wrap a User Control Inside of a Web Part for Sharepoint and when I try to actually load the web part I get the following error:

    An unexpected error occurred loading Web Part. Could not load the assembly 'MyWebPart, Version 1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5'. Make sure that it is compiled before accessing the page.

    I have added the dll file to the GAC (Windows/Assembly), added the assembly the Web Config file and copied the dll to the bin file for the sharepoint site but I continue to get the error.  Any ideas what could be wrong?
    Thursday, May 7, 2009 2:25 PM

Answers

  • there's probably a typo in the assembly (strong) name; could you copy and paste it by from reflector ?
    in your first post the assembly name is "WebPart" and in your web; in the web.config it is "TestWebPart2"; that's the problem...


    Serge Luca; blog: www.redwood.be
    Thursday, May 7, 2009 4:19 PM
  • Use the /_layouts/newdwp.aspx page to add the web part to the gallery. If you don't see it in that page, you've got the wrong entry in web.config. Also, make sure the class is public. 
    Daniel Larson, SharePoint MVP, MS Press Author, NewsGator Software Developer Check out my books on Amazon: - Inside Microsoft Windows SharePoint Services 3.0 (with Ted Pattson) - Developing Service Oriented AJAX Applications on the Microsoft Platform (.NET 3.5, WCF, Microsoft AJAX)
    Thursday, May 7, 2009 4:47 PM
  • You can use the Visual Studio 2008 extensions for SharePoint v1.3 to create the appropriate config files for GAC or BIN deployed web parts. Download it here: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=fb9d4b85-da2a-432e-91fb-d505199c49f6

    Regards,
    Paul
    SharePoint Product Manager. Posting is provided "AS IS" with no warranties, and confers no rights
    Thursday, May 21, 2009 6:39 PM

All replies

  • are you having more then one web application? make sure it in correct one. What your entry in web.config look like? It should look similar below

    <SafeControl Assembly="MyWebPartAseemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5" Namespace="TheWebPartNameSpace" TypeName="*" Safe="True" />

    Thursday, May 7, 2009 2:55 PM
  • I am editing the web.config file in G:\wss\Web1 which is where the sharepoint site is pointed to.  The entry in the file is:

    <

     

    SafeControl Assembly="TestWebPart2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5" Namespace="TestWebPart2" TypeName="*" Safe="True" />

    Thursday, May 7, 2009 4:00 PM
  • there's probably a typo in the assembly (strong) name; could you copy and paste it by from reflector ?
    in your first post the assembly name is "WebPart" and in your web; in the web.config it is "TestWebPart2"; that's the problem...


    Serge Luca; blog: www.redwood.be
    Thursday, May 7, 2009 4:19 PM
  • Use the /_layouts/newdwp.aspx page to add the web part to the gallery. If you don't see it in that page, you've got the wrong entry in web.config. Also, make sure the class is public. 
    Daniel Larson, SharePoint MVP, MS Press Author, NewsGator Software Developer Check out my books on Amazon: - Inside Microsoft Windows SharePoint Services 3.0 (with Ted Pattson) - Developing Service Oriented AJAX Applications on the Microsoft Platform (.NET 3.5, WCF, Microsoft AJAX)
    Thursday, May 7, 2009 4:47 PM
  • Hi,

    I'd guess that there is an issue with your assembly declaration.

    I use Red Gates Reflector to get this information.

    As an example, here's 1 I wrote earlier
    Inherits="UserProfileDelegate.MySitesRedirect, UserProfileDelegate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ffb9fd84c3f766eb"

    This basically equates to NameSpace.ClassName, AssemblyName
    Friday, May 8, 2009 9:18 AM
  • You can use the Visual Studio 2008 extensions for SharePoint v1.3 to create the appropriate config files for GAC or BIN deployed web parts. Download it here: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=fb9d4b85-da2a-432e-91fb-d505199c49f6

    Regards,
    Paul
    SharePoint Product Manager. Posting is provided "AS IS" with no warranties, and confers no rights
    Thursday, May 21, 2009 6:39 PM