[Mono-devel-list] How to implement Trace?

Pedro Santos pre at oninetspeed.pt
Sat Dec 6 17:14:36 EST 2003

I was trying to implement the TraceContext class that enables tracing.
This class recieves a HttpContext, and I get the page casting the
IHttpHandler given by the Handler proprety. Now I have the page, and I
have a DataSet container with the messages, but... Where do I append it?

Having the Page, I added a delegate to the PreRender event, that is
triggered just before the page rendering. The ideia was to access the
page children controls, and add a WebControl - having the previous
DataSet has the DataSource. Simply like this:
Controls.AddAt(Controls.Count, mycontrol);

However, the control is not shown. It appears that the Page render
method is built when compiling, and do not check at runtime the control
children. This is because, insted of having Literal controls with the
text, the method simply writes to the buffer the text. Well, this is not
how it is explained in Essential ASP .NET, but both Mono and the win
asp.net do it this way. Is it for performance?

So I have this problem. When tracing is enabled, I would like to add a
div element just before </bod></html> with the trace results. It must be
done some other way... if we cannot add controls to the Page in runtime,
where can we add it?

Maybe in some event from the HttpApplication just before sending the
request back, erasing </body></html> from the stream and adding the
trace content. And maybe rearrange the HTTP header Content-length with
the new value.


Pedro Santos <www.psantos.net>
"Si minor plus est ergo nihil sunt omnia..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20031206/3c29623e/attachment.bin 

More information about the Mono-devel-list mailing list