Jason Moore

I have a small web part that displays employee status at any given point in time (in, sick, vacation, etc.). It is a simple table with name, status and a comment. I have two dependent assemblies; an employee data provider and a component library. All three assemblies are signed and GAC'd.

When I upload a version of the web part that does not use the dependent assemblies (i.e. contains the data queries internally), it works great. Displays the web part, allows edit, etc. When I upload the version that gets the data from my data provider and makes use of the components library (which I prefer for isolation and reuse), I get "an error occurred when previewing the Web Part". When I throw it on a page, I get "the type initializer for <my provider data manager> threw and exception."

I have double checked the connection string and provider information in the web.config file and I have tried putting the dependent assembly information in various places in the web.config file but had no luck. I know I'm missing something simple. Can anyone give me insight into this exception or point me to more information

Thanks in advance,

-jm




Re: SharePoint - Development and Programming Dependent Assemblies of the WebPart

Bruce VB

Sorry I do not have the exact answer but there are security issues that have to be addressed using SQL connections in web part and the SharePoint web Process. I do not know the solution be it is not as easy as in a standard asp.net application. You may need to use a untrusted connection to get to the db.

Good luck.






Re: SharePoint - Development and Programming Dependent Assemblies of the WebPart

Jason Moore

Many thanks. But getting to the DB doesn't appear to be the issue as I can do it in the version that doesn't use the provider model.

-jm





Re: SharePoint - Development and Programming Dependent Assemblies of the WebPart

Peter ebSms

Just a quick check:

1. Have you tried adding the assemblies to the <SafeControls>-Section of your WSS-web.config

2. Some changes if you add <trust level="Full" originUrl="" /> to the <system.web>-section of the WSS-web.config

3. Show us your connection string. Some changes if you add <identity impersonate="true" /> to the <system.web>-section of the WSS-web.config

Greetings, Peter





Re: SharePoint - Development and Programming Dependent Assemblies of the WebPart

Peter ebSms

depending on what you do in your assemblies have a look:

http://support.microsoft.com/kb/839300/en-us

using ...

[assembly:AllowPartiallyTrustedCallers]
namespace MyWebPart
{

Don't know if my hints will help. Good luck.

Greetings, Peter