web part exception problem
- From: "the_nextman" <richard.markiewicz@xxxxxxxxxxxx>
- Date: 19 Dec 2006 14:06:43 -0800
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
.
- Follow-Ups:
- Re: web part exception problem
- From: monster
- Re: web part exception problem
- Prev by Date: GetUsageData() returning nothing
- Next by Date: Can not create alerts in moss2007 using API
- Previous by thread: GetUsageData() returning nothing
- Next by thread: Re: web part exception problem
- Index(es):
Relevant Pages
|