Re: Need help with ApplicationException
- From: "Kevin Spencer" <kevin@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 11 Aug 2005 14:14:14 -0400
Okay, I'm assuming that somewhere in this employee object stored in a
session variable is the "userid name." If so, and you're creating your own
custom Exception class (why are you inheriting ApplicationException instead
of Exception?), you can create a field named "userid" in the custom
Exception class, and implement a constructor method that includes the
"userid" as a parameter. Then in your Try/Catch (you ARE using Try/Catch,
aren't you???), you do something like the following:
catch (Exception ex)
{
throw new MyCustomException(ex.Message, ex,
((employee)Session["CurrentEmployee"]).userid);
}
Of course, what you do with your new Custom Exception is up to you, but I
hope you get the idea.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.
"Charles" <Charles@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D4BD738B-02BA-4E16-A5C8-238FEE2FA57A@xxxxxxxxxxxxxxxx
>I need to find a way to share information between two classes, one is an
> employee class and the other is a custom error class that inherits from
> ApplicationException. These two classes are part of a ClassLibrary
> project.
> The other project has all the web page classes.
>
> My project allows employees to log in using Forms Auth, I do some checking
> on the person that is logging in and then after that is good I create an
> employee object and that is stored in a session variable.
>
> What I would like is if this employee that logged in gets an error message
> at anytime during their use of the web site that the error gets logged
> with
> their userid name. I can log errors and all that, I am logging them to a
> database. What I need is just how do I get the error message with the
> userid
> name.
>
> Thanks,
> Charles
>
.
- Follow-Ups:
- Re: Need help with ApplicationException
- From: Charles
- Re: Need help with ApplicationException
- References:
- Need help with ApplicationException
- From: Charles
- Need help with ApplicationException
- Prev by Date: Best way to order a listing
- Next by Date: Re: Can someone tell me what is wrong here?
- Previous by thread: Need help with ApplicationException
- Next by thread: Re: Need help with ApplicationException
- Index(es):
Relevant Pages
|