views:

112

answers:

1

I'm having a problem getting a custom membership provider to work in SharePoint. The login page is displayed, but when I enter any credentials - right or wrong - I get the following error:

The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\Root\web.config line 22)

Line 22 is where my membership provider is configured. Its also configured in the root web sites web.config (since it needs to be configured in every virtual directory). If I remove line 22, I get the error complaining about the provider not being in every web.config, so that part seems to be working.

On the same web server, I have set up a default MVC project and confirmed that the membership provider works fine. I know sharepoint is loading it at least partially, because if I make it throw an exception in the constructor, I get a different error (Exception thrown by the invocation etc.), and the login form isn't even displayed.

The DLL is built as AnyCPU, against .NET Framework 3.5, and is in the GAC. The server is running Windows 2008 R2, 64-bit.

Can anyone point me in a direction to try?

A: 

Have you entered a <SafeControl> entry for the Membership provider?

John Ptacek
I hadn't, no. In fact, I didn't know it was necessary :) I just added one to the web.config for the virtual directory I'm trying to login to, and no change. There was no SafeControls section defined in the web services web.config, which is the bit thats throwing the error.
Ch00k
For any SharePoint application loading an external DLL you need to have a SafeControl entyr in the web.config. Are you getting the error in SharePoint or in an external web service? Is the external web service using a Membership Provider?
John Ptacek
The error comes from sharepoint, after I enter some login details. Maybe I'll try smattering the SafeControl tag around a few more places.
Ch00k
I put SafeControl entries for my DLL in all of the web.config files that had SafeControl entries, and nothing has changed.
Ch00k