Time on the phone –wasted time?
Saturday, July 01, 2006 4:14:26 PM (GMT Daylight Time, UTC+01:00)
After a somewhat hectic week on the phone I asked myself “has all this time on the phone been wasted time?” Well, I spent time talking to clients, developers, friends and family and this is important. Although it may cost you a little development time, talk is cheap (that’s what the telecom’s companies want to tell you isn’t it?)
Rather than looking at it negatively I tried to look at it from another point of view, I could have spent the time developing some weird and wonderful new creation for a client however, this phone time was doing something else –it was promoting the business. Admittedly the business couldn’t survive if we all spent all the time with the phone glued to our ear, but once in a while I believe is a good thing.
Why am I looking at it like that? That’s simple, if you make time for your clients, friends and family in any context it shows that you care for them beyond a pay check and at the end of the day, if they need some development they’re more likely to think of you in a good light.
Out of interest I decided to work out how much time I spent on non-development hours and I was somewhat shocked, in the average week I would estimate that at least 2 days is spent on non-development work, that includes phone calls, invoicing, letter writing, emailing etc. It's a staggering ammount but, all part of running a business.
Complete Lifecycle of an ASP.Net page and controls
Friday, June 30, 2006 9:01:00 AM (GMT Daylight Time, UTC+01:00)
Julian Voelcker raised a question on the MsWebDev mailing list the other day that I've been meaning to investigate for a while as it's something that I have to double check on every time I write a new custom control -the various lifecycles an ASP.Net page.
Many people have blogged about the lifecycle of an ASP.Net Page or Master Page but every time I need to find the complete lifecycle of a control it’s not so easy. Today I wrote a couple of test pages to generate a reference.
The pages are very simple, I just overrode every method I could find and wrote to the trace. For completeness when the method called its base I wrapped it with “Start MethodName” and “End MethodName” (if you look at the trace outputs below you will see why). I did this for the Master Page (.master), Page (.aspx), User Control (.ascx) and Web Control (.cs), the page structre was simple:
For clarity I’ve split the produced trace into 5 individual reference sections:
ASP.Net 2.0 Master Page Life Cycle
- Start Construct()
- End Construct()
- Start FrameworkInitialize()
- End FrameworkInitialize()
- Start AddParsedSubObject(object obj)
- CreateControlCollection()
- Start AddedControl(Control control, int index)
- End AddedControl(Control control, int index)
- End AddParsedSubObject(object obj)
- Start AddParsedSubObject(object obj)
- Start AddedControl(Control control, int index)
- End AddedControl(Control control, int index)
- End AddParsedSubObject(object obj)
- Start AddParsedSubObject(object obj)
- Start AddedControl(Control control, int index)
- End AddedControl(Control control, int index)
- End AddParsedSubObject(object obj)
- Start AddParsedSubObject(object obj)
- Start AddedControl(Control control, int index)
- End AddedControl(Control control, int index)
- End AddParsedSubObject(object obj)
- Start AddParsedSubObject(object obj)
- Start AddedControl(Control control, int index)
- End AddedControl(Control control, int index)
- End AddParsedSubObject(object obj)
- ResolveAdapter()
- Start OnInit(EventArgs e)
- End OnInit(EventArgs e)
- Start TrackViewState()
- End TrackViewState()
- Start OnLoad(EventArgs e)
- Page_Load(object sender, EventArgs e)
- End OnLoad(EventArgs e)
- Start EnsureChildControls()
- ResolveAdapter()
- Start CreateChildControls()
- End CreateChildControls()
- End EnsureChildControls()
- Start OnPreRender(EventArgs e)
- End OnPreRender(EventArgs e)
- SaveViewState()
- SaveViewState()
- HasControls()
- Start RenderControl(HtmlTextWriter writer)
- Start Render(HtmlTextWriter writer)
- Start RenderChildren(HtmlTextWriter writer)
- End RenderChildren(HtmlTextWriter writer)
- End Render(HtmlTextWriter writer)
- End RenderControl(HtmlTextWriter writer)
ASP.Net 2.0 Page Life Cycle
- ResolveAdapter()
- DeterminePostBackMode()
- Begin PreInit
- Start OnPreInit(EventArgs e)
- End OnPreInit(EventArgs e)
- HasControls()
- Start RemovedControl(Control control)
- End RemovedControl(Control control)
- ResolveAdapter()
- Start AddedControl(Control control, int index)
- End AddedControl(Control control, int index)
- End PreInit
- Begin Init
- ResolveAdapter()
- Start OnInit(EventArgs e)
- End OnInit(EventArgs e)
- Start TrackViewState()
- End TrackViewState()
- End Init
- Begin InitComplete
- Start OnInitComplete(EventArgs e)
- End OnInitComplete(EventArgs e)
- End InitComplete
- Begin PreLoad
- Start OnPreLoad(EventArgs e)
- End OnPreLoad(EventArgs e)
- End PreLoad
- Begin Load
- Start OnLoad(EventArgs e)
- Page_Load(object sender, EventArgs e)
- End OnLoad(EventArgs e)
- End Load
- Begin LoadComplete
- Start OnLoadComplete(EventArgs e)
- End OnLoadComplete(EventArgs e)
- End LoadComplete
- Begin PreRender
- Start EnsureChildControls()
- ResolveAdapter()
- Start CreateChildControls()
- End CreateChildControls()
- End EnsureChildControls()
- Start OnPreRender(EventArgs e)
- End OnPreRender(EventArgs e)
- End PreRender
- Begin PreRenderComplete
- Start OnPreRenderComplete(EventArgs e)
- End OnPreRenderComplete(EventArgs e)
- End PreRenderComplete
- SaveViewState()
- Begin SaveState
- SaveViewState()
- HasControls()
- Start SavePageStateToPersistenceMedium(object state)
- End SavePageStateToPersistenceMedium(object state)
- End SaveState
- Begin SaveStateComplete
- Start OnSaveStateComplete(EventArgs e)
- End OnSaveStateComplete(EventArgs e)
- End SaveStateComplete
- Begin Render
- CreateHtmlTextWriter(System.IO.TextWriter tw)
- Start RenderControl(HtmlTextWriter writer)
- Start Render(HtmlTextWriter writer)
- Start RenderChildren(HtmlTextWriter writer)
- End RenderChildren(HtmlTextWriter writer)
- End Render(HtmlTextWriter writer)
- End RenderControl(HtmlTextWriter writer)
- End Render
- CreateHtmlTextWriter(System.IO.TextWriter tw)
ASP.Net 2.0 User Control Life Cycle
- Start Construct()
- End Construct()
- Start FrameworkInitialize()
- End FrameworkInitialize()
- ResolveAdapter()
- Start OnInit(EventArgs e)
- End OnInit(EventArgs e)
- Start TrackViewState()
- End TrackViewState()
- Start OnLoad(EventArgs e)
- Page_Load(object sender, EventArgs e)
- End OnLoad(EventArgs e)
- Start EnsureChildControls()
- ResolveAdapter()
- Start CreateChildControls()
- End CreateChildControls()
- End EnsureChildControls()
- Start OnPreRender(EventArgs e)
- End OnPreRender(EventArgs e)
- SaveViewState()
- SaveViewState()
- HasControls()
- Start RenderControl(HtmlTextWriter writer)
- Start Render(HtmlTextWriter writer)
- Start RenderChildren(HtmlTextWriter writer)
- End RenderChildren(HtmlTextWriter writer)
- End Render(HtmlTextWriter writer)
- End RenderControl(HtmlTextWriter writer)
ASP.Net 2.0 Web Control Life Cycle
- Constructor Test()
- Start ApplyStyleSheetSkin(Page page)
- End ApplyStyleSheetSkin(Page page)
- ResolveAdapter()
- Start OnInit(EventArgs e)
- End OnInit(EventArgs e)
- Start TrackViewState()
- End TrackViewState()
- Start OnLoad(EventArgs e)
- End OnLoad(EventArgs e)
- Start EnsureChildControls()
- ResolveAdapter()
- Start CreateChildControls()
- End CreateChildControls()
- End EnsureChildControls()
- Start OnPreRender(EventArgs e)
- End OnPreRender(EventArgs e)
- SaveViewState()
- SaveViewState()
- HasControls()
- Start RenderControl(HtmlTextWriter writer)
- Start Render(HtmlTextWriter writer)
- Start RenderBeginTag(HtmlTextWriter writer)
- Start AddAttributesToRender(HtmlTextWriter writer)
- End AddAttributesToRender(HtmlTextWriter writer)
- End RenderBeginTag(HtmlTextWriter writer)
- Start RenderContents(HtmlTextWriter writer)
- Start RenderChildren(HtmlTextWriter writer)
- End RenderChildren(HtmlTextWriter writer)
- End RenderContents(HtmlTextWriter writer)
- Start RenderEndTag(HtmlTextWriter writer)
- End RenderEndTag(HtmlTextWriter writer)
- End Render(HtmlTextWriter writer)
- End RenderControl(HtmlTextWriter writer)
Complete Trace |
| Category |
Message |
| Page |
ResolveAdapter() |
| Page |
DeterminePostBackMode() |
| aspx.page |
Begin PreInit |
| Page |
Start OnPreInit(EventArgs e) |
| Page |
End OnPreInit(EventArgs e) |
| MasterPage |
Start Construct() |
| MasterPage |
End Construct() |
| Page |
HasControls() |
| Page |
Start RemovedControl(Control control) |
| Page |
End RemovedControl(Control control) |
| MasterPage |
Start FrameworkInitialize() |
| MasterPage |
End FrameworkInitialize() |
| MasterPage |
Start AddParsedSubObject(object obj) |
| MasterPage |
CreateControlCollection() |
| MasterPage |
Start AddedControl(Control control, int index) |
| MasterPage |
End AddedControl(Control control, int index) |
| MasterPage |
End AddParsedSubObject(object obj) |
| MasterPage |
Start AddParsedSubObject(object obj) |
| MasterPage |
Start AddedControl(Control control, int index) |
| Page |
ResolveAdapter() |
| MasterPage |
End AddedControl(Control control, int index) |
| MasterPage |
End AddParsedSubObject(object obj) |
| MasterPage |
Start AddParsedSubObject(object obj) |
| MasterPage |
Start AddedControl(Control control, int index) |
| MasterPage |
End AddedControl(Control control, int index) |
| MasterPage |
End AddParsedSubObject(object obj) |
| UserControl |
Start Construct() |
| UserControl |
End Construct() |
| UserControl |
Start FrameworkInitialize() |
| UserControl |
End FrameworkInitialize() |
| CustomWebControl |
Constructor Test() |
| CustomWebControl |
Start ApplyStyleSheetSkin(Page page) |
| CustomWebControl |
End ApplyStyleSheetSkin(Page page) |
| MasterPage |
Start AddParsedSubObject(object obj) |
| MasterPage |
Start AddedControl(Control control, int index) |
| MasterPage |
End AddedControl(Control control, int index) |
| MasterPage |
End AddParsedSubObject(object obj) |
| MasterPage |
Start AddParsedSubObject(object obj) |
| MasterPage |
Start AddedControl(Control control, int index) |
| MasterPage |
End AddedControl(Control control, int index) |
| MasterPage |
End AddParsedSubObject(object obj) |
| Page |
Start AddedControl(Control control, int index) |
| Page |
End AddedControl(Control control, int index) |
| aspx.page |
End PreInit |
| aspx.page |
Begin Init |
| Page |
ResolveAdapter() |
| MasterPage |
ResolveAdapter() |
| UserControl |
ResolveAdapter() |
| UserControl |
Start OnInit(EventArgs e) |
| UserControl |
End OnInit(EventArgs e) |
| UserControl |
Start TrackViewState() |
| UserControl |
End TrackViewState() |
| CustomWebControl |
ResolveAdapter() |
| CustomWebControl |
Start OnInit(EventArgs e) |
| CustomWebControl |
End OnInit(EventArgs e) |
| CustomWebControl |
Start TrackViewState() |
| CustomWebControl |
End TrackViewState() |
| MasterPage |
Start OnInit(EventArgs e) |
| MasterPage |
End OnInit(EventArgs e) |
| MasterPage |
Start TrackViewState() |
| MasterPage |
End TrackViewState() |
| Page |
Start OnInit(EventArgs e) |
| Page |
End OnInit(EventArgs e) |
| Page |
Start TrackViewState() |
| Page |
End TrackViewState() |
| aspx.page |
End Init |
| aspx.page |
Begin InitComplete |
| Page |
Start OnInitComplete(EventArgs e) |
| Page |
End OnInitComplete(EventArgs e) |
| aspx.page |
End InitComplete |
| aspx.page |
Begin PreLoad |
| Page |
Start OnPreLoad(EventArgs e) |
| Page |
End OnPreLoad(EventArgs e) |
| aspx.page |
End PreLoad |
| aspx.page |
Begin Load |
| Page |
Start OnLoad(EventArgs e) |
| Page |
Page_Load(object sender, EventArgs e) |
| Page |
End OnLoad(EventArgs e) |
| MasterPage |
Start OnLoad(EventArgs e) |
| MasterPage |
Page_Load(object sender, EventArgs e) |
| MasterPage |
End OnLoad(EventArgs e) |
| UserControl |
Start OnLoad(EventArgs e) |
| UserControl |
Page_Load(object sender, EventArgs e) |
| UserControl |
End OnLoad(EventArgs e) |
| CustomWebControl |
Start OnLoad(EventArgs e) |
| CustomWebControl |
End OnLoad(EventArgs e) |
| aspx.page |
End Load |
| aspx.page |
Begin LoadComplete |
| Page |
Start OnLoadComplete(EventArgs e) |
| Page |
End OnLoadComplete(EventArgs e) |
| aspx.page |
End LoadComplete |
| aspx.page |
Begin PreRender |
| Page |
Start EnsureChildControls() |
| Page |
ResolveAdapter() |
| Page |
Start CreateChildControls() |
| Page |
End CreateChildControls() |
| Page |
End EnsureChildControls() |
| Page |
Start OnPreRender(EventArgs e) |
| Page |
End OnPreRender(EventArgs e) |
| MasterPage |
Start EnsureChildControls() |
| MasterPage |
ResolveAdapter() |
| MasterPage |
Start CreateChildControls() |
| MasterPage |
End CreateChildControls() |
| MasterPage |
End EnsureChildControls() |
| MasterPage |
Start OnPreRender(EventArgs e) |
| MasterPage |
End OnPreRender(EventArgs e) |
| UserControl |
Start EnsureChildControls() |
| UserControl |
ResolveAdapter() |
| UserControl |
Start CreateChildControls() |
| UserControl |
End CreateChildControls() |
| UserControl |
End EnsureChildControls() |
| UserControl |
Start OnPreRender(EventArgs e) |
| UserControl |
End OnPreRender(EventArgs e) |
| CustomWebControl |
Start EnsureChildControls() |
| CustomWebControl |
ResolveAdapter() |
| CustomWebControl |
Start CreateChildControls() |
| CustomWebControl |
End CreateChildControls() |
| CustomWebControl |
End EnsureChildControls() |
| CustomWebControl |
Start OnPreRender(EventArgs e) |
| CustomWebControl |
End OnPreRender(EventArgs e) |
| aspx.page |
End PreRender |
| aspx.page |
Begin PreRenderComplete |
| Page |
Start OnPreRenderComplete(EventArgs e) |
| Page |
End OnPreRenderComplete(EventArgs e) |
| aspx.page |
End PreRenderComplete |
| Page |
SaveViewState() |
| MasterPage |
SaveViewState() |
| UserControl |
SaveViewState() |
| CustomWebControl |
SaveViewState() |
| aspx.page |
Begin SaveState |
| Page |
SaveViewState() |
| Page |
HasControls() |
| MasterPage |
SaveViewState() |
| MasterPage |
HasControls() |
| UserControl |
SaveViewState() |
| UserControl |
HasControls() |
| CustomWebControl |
SaveViewState() |
| CustomWebControl |
HasControls() |
| Page |
Start SavePageStateToPersistenceMedium(object state) |
| Page |
ResolveAdapter() |
| Page |
End SavePageStateToPersistenceMedium(object state) |
| aspx.page |
End SaveState |
| aspx.page |
Begin SaveStateComplete |
| Page |
Start OnSaveStateComplete(EventArgs e) |
| Page |
End OnSaveStateComplete(EventArgs e) |
| aspx.page |
End SaveStateComplete |
| aspx.page |
Begin Render |
| Page |
CreateHtmlTextWriter(System.IO.TextWriter tw) |
| Page |
Start RenderControl(HtmlTextWriter writer) |
| Page |
Start Render(HtmlTextWriter writer) |
| Page |
Start RenderChildren(HtmlTextWriter writer) |
| MasterPage |
Start RenderControl(HtmlTextWriter writer) |
| MasterPage |
Start Render(HtmlTextWriter writer) |
| MasterPage |
Start RenderChildren(HtmlTextWriter writer) |
| UserControl |
Start RenderControl(HtmlTextWriter writer) |
| UserControl |
Start Render(HtmlTextWriter writer) |
| UserControl |
Start RenderChildren(HtmlTextWriter writer) |
| UserControl |
End RenderChildren(HtmlTextWriter writer) |
| UserControl |
End Render(HtmlTextWriter writer) |
| UserControl |
End RenderControl(HtmlTextWriter writer) |
| CustomWebControl |
Start RenderControl(HtmlTextWriter writer) |
| CustomWebControl |
Start Render(HtmlTextWriter writer) |
| CustomWebControl |
Start RenderBeginTag(HtmlTextWriter writer) |
| CustomWebControl |
Start AddAttributesToRender(HtmlTextWriter writer) |
| CustomWebControl |
End AddAttributesToRender(HtmlTextWriter writer) |
| CustomWebControl |
End RenderBeginTag(HtmlTextWriter writer) |
| CustomWebControl |
Start RenderContents(HtmlTextWriter writer) |
| CustomWebControl |
Start RenderChildren(HtmlTextWriter writer) |
| CustomWebControl |
End RenderChildren(HtmlTextWriter writer) |
| CustomWebControl |
End RenderContents(HtmlTextWriter writer) |
| CustomWebControl |
Start RenderEndTag(HtmlTextWriter writer) |
| CustomWebControl |
End RenderEndTag(HtmlTextWriter writer) |
| CustomWebControl |
End Render(HtmlTextWriter writer) |
| CustomWebControl |
End RenderControl(HtmlTextWriter writer) |
| MasterPage |
End RenderChildren(HtmlTextWriter writer) |
| MasterPage |
End Render(HtmlTextWriter writer) |
| MasterPage |
End RenderControl(HtmlTextWriter writer) |
| Page |
End RenderChildren(HtmlTextWriter writer) |
| Page |
End Render(HtmlTextWriter writer) |
| Page |
End RenderControl(HtmlTextWriter writer) |
| aspx.page |
End Render |
| Page |
CreateHtmlTextWriter(System.IO.TextWriter tw) |
What's the RX-8 Look Like?
Monday, June 26, 2006 9:19:24 AM (GMT Daylight Time, UTC+01:00)
It's been brought to my attention that some people out there STILL don't know what the RX-8 looks like so I thought I'd post a little photo of it here for you:

Visit Mazda's RX-8 Showcase Site
I'll try and post a few more later of the interior etc.
Growing Old Gracefully
Sunday, June 25, 2006 10:55:39 PM (GMT Daylight Time, UTC+01:00)
This morning we had the TV on while getting ready to go out and a new L'Oreal advert came on. If you haven't seen it, it has features Jane Fonda telling us how the product helps firm the skin etc, that she's 68 and look how great her skin is -the usual junk. Although the advert doesn't actually say the product is why she "looks so good" it leads you to believe that it is (great marketing btw) anyway, where am I going with this (other than stating the obvious)? Well, when the advert finishedI was left thinking "ok, so this cream makes your skin feeling younger" and "L'Oreal is the answer to all your old age prayers" but surely they're contradicting themselves a touch? Firstly they've got this attractive 68year old promoting this product as well as a 20-something saying "Use this and you won't look old when you're older". Well if Jane's 68 and looks like that (yeah yeah with all that plastic surgery etc) then why invest thousands in the anti-aging creams? -You can just use that one when you're 68. Oh and if she's 68 -don't people think "Hang on, she looks good, she's been around well before L'Oreal started pimping these promises so why should I buy it?" -just a thought! As I keep saying to Stacey, it's been long known that it's all in the genes -any guy that wants to know what his lovely lady is going to look like at 40 all he needs to do is look at her mum...
Here's a shot of Jane for those of you who don't know who she is/was (I didn't know it was her until I checked out the L'Oreal site
)

L'Oreal Website (For the product of the advert)
On that note, another advert was listing the signs a woman had noted of getting older -a grey/white hair here-or-there, a wrinkle or two and loosing her eyesight/hearing which again got me thinking, I don't think I'll even notice getting old. During the summer my hair goes white in the sun, I can't see, my hearing's not great at the best of times and as Stacey keeps reminding me I've already got wrinkles on my forehead so...
Error Reporting and the Trace in ASP.Net 2.0 -Code Update
Friday, June 23, 2006 5:34:31 PM (GMT Daylight Time, UTC+01:00)
I've just had it pointed out to me (and quite rightly so) by Craig that my code for enabling the trace with Phil Winstanley's WebException was a touch wrong. I was assuming that the user was (correctly imho) running the application with the trace already disabled. However correct that may be, it may not be the case so as pedantic as this is, the code snippet should really be:
TraceContext t = HttpContext.Current.Trace;
bool bCurrentState = t.IsEnabled;
t.IsEnabled = true;
WebException WE = new WebException();
WE.CurrentException = Server.GetLastError();
WE.Handle();
t.IsEnabled = bCurrentState;
Although I've adapted the code to accomodate this, I really wouldn't run production sites with the trace enabled as this is not only a performace hit but quite a security issue!
Crazy Job Advert
Friday, June 23, 2006 5:16:32 PM (GMT Daylight Time, UTC+01:00)
Sometimes you really do have to wonder what recruiters are thinking but something tells me, this guy isn’t going to get too many applicants!

Crazy Job Advert
The Advert can be seen here
Road Trip
Thursday, June 22, 2006 9:04:38 PM (GMT Daylight Time, UTC+01:00)
Ok, so my RX-8's on it's way over to Rotterdam and should be here in the UK around the 4th, so I thought it was time to start planning a road trip. I've been thinking about a raod trip for a while now and previously I was thinking of going to Italy via Germany but seeing as a friend has just moved to Copenhagen I thought it made sense to pop over there too.
For those of you interested, this is my initial plan:
Distance: 3,449.85 miles
Time: 60hrs 46mins
Toll costs: 143.18 GBP
Road tax cost: 5.14 GBP
Based on 25mpg and an average of £0.90per litre (I'm hoping its cheaper in Europe than here):
Petrol costs: 496.78 GBP
Giving total costs: 645.10 GBP + food/accommodation
Stopping off at:
- Rotterdam
- Hamburg
- Copenhagen
- Berlin
- Nurnberg
- Verona
- San Marino (it’s only a small detour)
- Rome
- Napoli
- Amalfi
- Genova
- Dijon
- Chalons-on-Champagne
- Calais
- Dover
- London…
The Route
Welcome
Thursday, June 22, 2006 6:29:32 PM (GMT Daylight Time, UTC+01:00)
Welcome to my new blog, it's something that I've been meaning to do for a while but due to "other" commitments haven't had the chance. As and when I get new things to write about I'll be adding them here.
I'm not intending this blog to be targetted at anything in specific but I hope to air ideas and concepts that pass by me.
It's been made
Wednesday, June 21, 2006 8:11:33 PM (GMT Daylight Time, UTC+01:00)
After a sleepless night I decided to give the dealer a call to find out what the score was with my RX-8, apparently it's been built and its on the way over from Japan to Rotterdam where it will go through a few final customisations for the UK before being sent to the dealer for the final trimmings.
It's all most exciting!
I also found out an interesting fact, I was wondering how they manage to keep the delivery miles so low, it turns out when its being shipped its put into Transit Mode (or something like that) where the speedo is deactivated, then when it arrives at the dealership, they take a week to make it roadworthy etc.
The long and short of it is that it has an ETA in the UK of 4th August allowing 7days for it to be sorted, I should have it when I return from Denmark on the 14th 
Phil Winstanley's Error Reporting and the Trace in ASP.Net 2.0
Monday, June 19, 2006 10:43:44 AM (GMT Daylight Time, UTC+01:00)
We've been using Phil Winstanley's ASP.Net WebException handler for a while now it's great (see http://weblogs.asp.net/plip/archive/2004/04/17/114984.aspx) the problem with it was that we couldn't get access to the Trace in ASP.Net 1.1. Doug and I spoke with Phil about it but at the time there wasn't a solution however he did say he thought there may be with the emergance of ASP.Net 2.0 (this was a few months before it was due to be released).
Now we're working in 2.0 on a regular basis I thought I'd give it a go and think I have a solution (though quite how reliable it is I'm not 100% sure). The fix is to tap into the current HttpContext and "switch" the trace's output on and then off before and after handling the exception and voila!
Here's my solution:
TraceContext t = HttpContext.Current.Trace;
t.IsEnabled = true;
WebException WE = new WebException();
WE.CurrentException = Server.GetLastError();
WE.Handle();
t.IsEnabled = false;