External component has thrown an exception

Aug 18, 2008 at 8:21 PM
Hi all,
I'm trying to load a asp.net user control with AJAX through the Smartpart with AJAX control.  When I try to load my user control through the tool pane in sharepoint, it says "Could not load <usercontrol>".  When I go ahead and add it anyway, it throws this error message: "External component has thrown an exception".  My user control code does reference an external assembly, so I'm wondering if the "external component" in this case is that assembly that I reference.  I've compiled and strong-named the assembly and have copied it in the MOSS server GAC, bin directory of my sharepoint site and also in the _app_bin directory of the sharepoint site.  I've also tried adding a SafeControl and dependentAssembly tag for the assembly in the site web.config, but to no avail.  I've made sure the <usercontrol>.ascx and <usercontrol>.ascx.cs files are in the "UserControls" directory of my web app.  Are there any other files I'm supposed to add to this location when the user control references an external assembly? 

I'm using "Return of the SmartPart" v1.3.  Anyone come across a similar issue?  Any help will be appreciated.

Thanks.
Sep 10, 2008 at 4:56 AM
I am experiencing the same issue...can someone tell me what is the solution to this?
Sep 10, 2008 at 3:19 PM
Hi,
In my case, it turned out that there was an issue with my code itself throwing an exception.  I couldn't tell before I deployed the user control as a smartpart, because I was testing the user control separately in a web app, and it was trying to read a setting from the web app's web.config.  When I deployed the user control as a smartpart, I didn't change the code that was reading from the web.config, which would obviously fail as it couldn't find the web.config file.  So my solution was to put a work-around for that piece of code. 
Hope that at least points you in the right direction.
Sep 12, 2008 at 6:22 AM
do u think it can be if the user controls are using an assembly for data access and this data assembly is not available in the bin directory of the sharepoint virtual directory for the particular web application. Similarly if there is some web service being called in the user control, will it be an issue?