web part exception problem



Hi all,

I am a fairly new to .NET and totally new to web part development so
please bear with me...

I have inherited a web part from my predecessor. It seems very simple -
it gets the current context (WSS or SPS) and retrieves a list of the
domain groups with access. Then it calls system.directorysearcher to
retrieve a list of users for these groups, before spitting the whole
lot back out as html.

There is a very intermittent problem with the directory bind. About 1
/100 times it will fail. This is proving very, very difficult to solve
- seems to be a connection issue. While I'm trying to resolve this
issue, I have another one - whenever the web part fails, it displays
the standard Sharepoint ERROR.gif, along with "We're sorry an
unexpected error has occured. An unexpected error has occured. If this
is reoccuring please contact a system administrator".

The fact is - the web part is not that important. It is important to 1%
of our users, and they know to clear the error by force refreshing the
page a couple of times. The other 99% of users don't care about the web
part - but when they see that error message it throws them into a state
of complete panic.

I need to override that error message with something like "Can't
retrieve user info at this time" or at least something less panic
inducing. But I can't.

[Code]

protected override void RenderWebPart(HtmlTextWriter output)
{
try
{
output.Write(RenderOutPutText());
}
catch(Exception ex)
{
output.Write("Unable to retrieve users at this time:<br><br><br>" +
ex.ToString());
}
}

private static string RenderOutPutText()
{
string returnString;

returnString = "<table><tr style='border-bottom: solid 1px
#E0E0E0;'><td ><b>People who have access</b></td></tr>";
returnString += "<tr style='border-bottom: solid 1px
#E0E0E0;'><td>" + GenerateGroupList() + "</td></tr></table>";

return returnString;
}


private static string GenerateGroupList()
{ //calls methods to retrieve groups, then users, then generates html
and returns it to RenderOutPutText

[/code]

My custom error message never gets displayed - just (what I assume) is
the standard Sharepoint exception.

Does anyone have any pointers? This is driving me mad!

Many thanks in advance, Richard

.



Relevant Pages

  • Re: PR_ATTACH_SIZE
    ... OutlookSpy - Outlook, CDO ... I would like to know how do you interpret the error message? ... the messages I want, I noticed that when I retrieve the PR_ATTACH_SIZE, ... Btw, do I need to an OpenAttach before able to obtain PR_ATTACH_SIZE? ...
    (microsoft.public.exchange.development)
  • Re: Preventing Duplicate Records
    ... the number of occurrences of a record and with DLookup to retrieve a ... I added a MSGBOX to display the results so I could ... If ScanCount> 0 then ... scaned it and if it is> than 0 return th error message. ...
    (comp.databases.ms-access)
  • Cache administrator
    ... Please can somebody help, i keep getting this error message from my linux server, when i try and browse using lynx. ... While trying to retrieve the URL: http://www.google.com/ ... The cache administrator may need to double-check the cache configuration. ... The requested URL can not currently be retrieved. ...
    (RedHat)
  • Re: web part exception problem
    ... I think the reason why you are seeing the standard SharePoint exception ... Why dont you see your error message? ... retrieve a list of users for these groups, ...
    (microsoft.public.sharepoint.portalserver.development)

Quantcast