Trace.axd

C

cameron

I have a bunch of custom error handling, (page and application), and
when an error occurs I get it to email me the error, the form data, the
querystring data, the cookie data and the Server variables.This data is
great and has helped solve a lot of bugs but I would also like the trace
information, (i.e. trace.axd), from the current request. Does anyone
know how to get that information in code, (c#), so that I could attach
it to my email?

Thanks

-Cam
 
C

cameron

Ok, lets tackle this from a different angle then. If I can't get that
info into my error handler, I should be able to inherit from the
existing System.Web.Handlers.TraceHandler/write my own and then send
emails from there if an error has occured, (as soon as I see something
with a system exception written as a warn I know I have encountered an
error).

Rajiv. R said there is no documentation on this object but that it pull
information from the stack - I guess I can assume that no one really
knows how it does that either?

-Cam
 
S

Steven Cheng[MSFT]

Hi Cam,


Thanks for your followup. Yes, as Rajiv. R has mentioned that the trace.axd
is actually processed by the Trace HttpHandler which is a buildin component
in ASP.NET and the System.Web.Handlers.TraceHandler class doestn't expose
public interface for developer to manually retrieve some certain internal
datas. Since you're trying to manually
provide a custom handler derived from it, here are some tech refrerece on
developing ASP.NET httphandlers:

#Exploring ASP.NET Session State and Cache data
http://www.codeproject.com/aspnet/exploresessionandcache.asp

#Inside IIS & ASP.NET
http://www.theserverside.net/articles/article.aspx?l=IIS_ASP

# Extending ASP.NET with HttpHandlers and HttpModules
http://www.devx.com/dotnet/Article/6962/0/page/3

Hope they're helpful.



Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
C

cameron

Yes I checked them out. But since none of them cover how to retrieve the
trace information, they are of very little use to me.

-Cam
 
S

Steven Cheng[MSFT]

Hi Cam,

Thank you for the followup. Since you are focus on getting the trace info,
I'm afraid the only means maybe to provide a custom tracehandler which
derived from the System.Web.Handlers.TraceHandler as you mentioned in the
former message. However, I found that this class is undocumented in MSDN or
somewhere else. Have you had any progress on this means?


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security(This posting is provided "AS IS",
with no warranties, and confers no rights.)
 
S

Stephen Oakman

I've just been looking at customizing the trace.axd output and have
hit the same brick wall. I was hoping trace.axd output just straight
xml and that there was a stylesheet that rendered this data and that I
could find the location of this stylesheet and modify it. No joy
there.

The output of the tracehandler is straight html and after using .net
reflector there's a private const that holds the css so it's nicely
hardcoded into the handler. Nice.

There are two protected methods that you should be able to override if
you inherit from this class. These are:

ShowDetails(DataSet): Void
ShowRequests(ArrayList): Void

I haven't made any attempt to inherit from this class yet but I would
hope that the DataSet passed in to ShowDetails contains the data we're
all after.

When I get the time I'm planning on trying to tackle this and creating
a generic class that outputs the trace via trace.axd as raw xml and
that this can then be transformed however you like. If I manage to
succeed in this then I'll make it freely and publicly available.

I hope this helps in some way.

Cheers

+Steve
 
S

Stephen Oakman

Have now done a bit more digging on this. The 2 methods I was going to
override aren't marked as virtual ect - so can't override.

Have now run a decompiler over System.Web.dll and have now found where
it get's it's data from. The call is within ProcessRequest of the
TraceHandler and is HttpRuntime.Profile.GetData() which returns an
arraylist with each index being the details of a request held as a
dataset. The list is reset by calling HttpRuntime.Profile.Reset()
which clears the trace list.

I'm just digging for more details but it looks like this
HttpRuntime.Profile is hidden and again undocumented but at least I'm
getting somewhere.

Hopefully the next time you hear from me it will be to give a link to
where you can download the custom trace handler and full documentation
on it's use.

Cheers

+Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top