A: 

the page that threw the error should be in the Exception.StackTrace property

http://msdn.microsoft.com/en-us/library/system.exception.stacktrace.aspx

I'm not sure where the code-snippet you mention comes from though.

codeulike
+3  A: 

You should take a look at the ELMAH project which will allow you to automatically capture and log all unhandled exceptions including recording the yellow screen of death.

For each error, as well as recording the YSOD, and stack trace it will also record the server variables too so you can see information such as http referer, page requested, etc.

It can record exceptions in a various databases or xml files, and send you an email as they are logged. It can be integrated into a running .Net web application without changing a line of code, just adding entries to web.config

You can also log entries in the log programatically for when you want to catch the exception but still record it.

Full details are on the ELMAH website, and a quick start guide can be found on the wiki.

Pervez Choudhury
A: 

ELMAH is very cool, drop-in, unhandled error logging component. It will even allow you to see the yellow screen of death (which includes the information you're after) as well as post data.

Jimmie R. Houts