Wednesday, January 7, 2009

ErrorWebPart ( ASP.net )

Scenario:
My friend called me again this morning and mentioned me that code which I blogged in this article have some issues. Well, that not new :-) .

Basically SPLimitedWepPartManager.Webparts was returning ErrorWebPart inspite of returning correct WebPart type.

Solution:
I tried analyzing the issue and found a weird solution.

Observation 1: There were some Custom webparts on the page , and the binaries for the same was in BIN

Fix 1 : Move the binaries to GAC ( this should make it work mostly )

still it didn't fix for him.

Observation 2: Code he was executing was in a Console Application/ Win Application.
Fix 2 : Move the code into a layout page. ( this one fixed the issue )

Learned something new today :-)

2 comments:

Jeremiah February 9, 2012 at 4:40 PM  

Your GAC solution helped me fix this issue while running a PowerShell script. Thanks!

Anonymous,  June 13, 2012 at 7:58 AM  

Hello Sandeep,

How can I get the ErrorWebPart Name or Title programmatically? Pls help me.

Pls send your solution to
sridhar529@yahoo.co.in

-Sridhar