We'd like to just capture the YSOD output to use in an erorr reporting email, from a Global.asax error handler, for instance. Is there any way of leveraging the built-in ysod generator?
Yes there is a way that you can do this.
In the Application_Error event in the global.asax file, get the last exception as an System.HttpUnhandledException. Your code will look like this:
var lastException = Server.GetLastError() as HttpUnhandledException;
string Ysod = lastException.GetHtmlErrorMessage();
// your call to emailing routine follows
I agree with other people's comments. You can also do this with ELMAH.