Re: Determening where a function was called from
From: Christopher Kimbell (a_at_b.c)
Date: 06/24/04
- Next message: Cesar Saucedo: "Getting "A potentially Dangerous Request.Cookies Value" error"
- Previous message: John Saunders: "Re: serving MSPX Pages with IIS6.0"
- In reply to: Sunny: "Re: Determening where a function was called from"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 24 Jun 2004 23:08:55 +0200
Thanks a bunch.
Chris
"Sunny" <sunnyask@icebergwireless.com> wrote in message
news:OZ6eMEiWEHA.3420@TK2MSFTNGP12.phx.gbl...
> Hi Chris,
>
>
> In article <40db2339@news.broadpark.no>, a@b.c says...
> > The Trace class in the .NET framework provides basic tracing
capabilities. I
> > would like to create my own tracer that includes the date and time the
trace
> > occured and what function and class the trace was called from.
> >
> > The date and time is no problem, the tricky bit is to determine where
the
> > function was called from, I only want to go one level up, not the whole
call
> > stack. Is there any way to use reflection to determine the calling
function?
> > I had a look at the MethodBase class but I can't find any promising
> > properties or methods. Since the call stack is used when getting the
stack
> > trace from an exception and for security checks, I was hoping it would
be
> > possible to get hold of something I could use.
> >
> > Chris
> >
>
> I'm using this:
>
> private static string GetCallerInfo()
> {
> StackTrace st = new StackTrace(3);
> return st.GetFrame(0).GetMethod().DeclaringType.FullName +
> "." + st.GetFrame(0).GetMethod().Name;
> }
>
> Sunny
- Next message: Cesar Saucedo: "Getting "A potentially Dangerous Request.Cookies Value" error"
- Previous message: John Saunders: "Re: serving MSPX Pages with IIS6.0"
- In reply to: Sunny: "Re: Determening where a function was called from"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|