Add Source file link to the default ASP.NET Server Error page?

Posted by Max Schilling on Stack Overflow See other posts from Stack Overflow or by Max Schilling
Published on 2010-01-12T16:25:15Z Indexed on 2010/05/04 18:38 UTC
Read the original article Hit count: 158

Has anyone ever thought to attempt to modify the default ASP.NET Server error page to provide a link BACK to the error source in Visual Studio?

Consider the following standard error page in ASP.NET:


Server Error in '/myproject' Application.

Invalid object name 'usp_DoSomething'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'usp_DoSomething'.

Source Error:

Line 4323:                    cmd.CommandText = "usp_DoSomething";
Line 4324:
Line 4325:                    using (var dr = cmd.ExecuteReader())
Line 4326:                    {
Line 4327:                        if (dr != null)

Source File: c:\development\myproject\myproject.components\providers\sql\sqldataprovider.cs Line: 4325


When an error like this is generated, the HTML has the source back to the file the error occurs in and the line number. Has anyone ever written or thought of writing some mechanism to turn the text into a link back to the error in Visual Studio?

I've never seen anything that does it, but it just seems like it would be a helluva nice feature and I think about it in the back of my mind every time an error occurs when I have to manually go find it in the source. It would just be nice to be able to click a link to take me straight there.

Anyone written any, or know of any solutions for this. I use Chrome or Firefox as my browsers of choice, but I'd even consider using IE again if someone found a plugin that did this.

Thanks,

Max

© Stack Overflow or respective owner

Related posts about visual-studio

Related posts about ASP.NET