472,331 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 software developers and data experts.

getting those built in error pages

I am wanting to get those cool html error pages that ms produces when I hit
an error in asp.net. For instance, when I get a compilation error I get an
html error page that shows me the

Description:
Compiler Error Message:
Source Error:
Source File:

The main thing I want is the Source Error. This give me a few lines of the
code with line numbers.
The other thing is the Compiler Error. This gives me the, "var1 not
declared" or something, error.

Ideally I would like to shoot the html page to my email.

Is this possible.

FYI .... I have this already in the global file.

Dim ex As Exception = Server.GetLastError()
request.path
ex.Message
ex.StackTrace
ex.Source
Request.Form.ToString()
Request.QueryString.ToString()
ex.TargetSite.ToString()
ex.ToString()

All of which is emailed to me and does not include the line number or the
Compiler Error Message.
Any ideas?

Thanks,
Larry
Nov 18 '05 #1
4 1713
Hi Larry,

Yeah, it's possible but you have to do a little work. You can only get this
info if you have the source code, which in a production app is unlikely.

I have built an WebErrorHandler class that pretty much does what you're
looking for - it generates a detailed error message and logs it and then
also sends an email out with the info.

To get the info you're looking for, you can look at the Server.StackTrace.
Here's is the key method called Parse from the error handler that takes
common error info and drops it into properties of the WebErrorHandler
object. It includes code to pull the source code if available:
public bool Parse()
{
if (this.LastError == null)
return false;

IsParsed = true;

// *** Use the Inner Exception since that has the actual error info
HttpRequest Request = HttpContext.Current.Request;

this.RawUrl = Request.RawUrl;

if ( LastError is System.IO.FileNotFoundException)
this.ErrorMessage = "File not found: " + LastError.Message;
else
this.ErrorMessage = LastError.Message;

this.Time = DateTime.Now;

if (this.CompactFormat)
return true;

this .StackTrace = LastError.StackTrace;
if (this.RetrieveSourceLines)
{
StringBuilder sb = new StringBuilder(1024);

// *** Try to retrieve Source Code information
StackTrace st = new StackTrace(LastError,true);
StackFrame sf = st.GetFrame(0);
if (sf != null)
{
string Filename = sf.GetFileName();

if (RetrieveSourceLines && Filename != null)
{
int LineNumber = sf.GetFileLineNumber();
if (LineNumber > 0)
{
StreamReader sr = new StreamReader(Filename);

// *** Read over unwanted lines
int x = 0;
for (x = 0; x < LineNumber - 4; x++ )
sr.ReadLine();

sb.Append("--- Code ---\r\n");
sb.AppendFormat("File: {0}\r\n",Filename);
sb.AppendFormat("Method: {0}\r\n\r\n",LastError.TargetSite);
sb.AppendFormat("Line {0}: {1}\r\n",x + 1,sr.ReadLine());
sb.AppendFormat("Line {0}: {1}\r\n",x + 2,sr.ReadLine());
sb.AppendFormat("Line {0}: {1}\r\n",x + 3,sr.ReadLine());
sb.AppendFormat("<b>Line {0}: {1}</b>\r\n", x+
4,sr.ReadLine() );
sb.AppendFormat("Line {0}: {1}\r\n",x +5,sr.ReadLine());
sb.AppendFormat("Line {0}: {1}\r\n",x +6,sr.ReadLine());
sb.AppendFormat("Line {0}: {1}\r\n",x +7,sr.ReadLine());

sr.Close();
}
}
}

this.SourceCode = sb.ToString();
}

this.FullUrl =
string.Format("http://{0}{1}",Request.ServerVariables["SERVER_NAME"],Request
..RawUrl);
this.IPAddress = Request.UserHostAddress;

if (Request.UrlReferrer != null)
this.Referer = Request.UrlReferrer.ToString();

this.Browser = Request.UserAgent;

if (Request.IsAuthenticated)
this.Login = HttpContext.Current.User.Identity.Name;
else
this.Login = "Anonymous";

if (Request.TotalBytes > 0 && Request.TotalBytes < 2048)
{
this.PostBuffer =
Encoding.GetEncoding(1252).GetString(Request.Binar yRead(Request.TotalBytes))
;
this.ContentSize = Request.TotalBytes;
}
else if (Request.TotalBytes > 2048) // strip the result
{
this.PostBuffer =
Encoding.GetEncoding(1252).GetString(Request.Binar yRead(2048)) + "...";
this.ContentSize = Request.TotalBytes;
}

return true;

}

The class then wrappers everything up into a single text string that can be
logged and emailed but that's pretty trivial. The final result looks
something like this:

/wwWebstore/admin/ErrorTestPage.aspx

Object reference not set to an instance of an object.
on 12/19/2003 8:47:57 pm

--- Stack Trace ---
at Westwind.WebStore.ErrorTestPage.Page_Load(Object sender, EventArgs e)
in
d:\projects\wwWebStore\Admin\ErrorTestPage.aspx.cs :line 26
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()

--- Code ---
File: d:\projects\wwWebStore\Admin\ErrorTestPage.aspx.cs
Method: Void Page_Load(System.Object, System.EventArgs)

Line 23:
Line 24: // Now explicitly set this value to null
Line 25: Invoice = null;
<b>Line 26: Invoice.GetBlankRecord();</b>
Line 27: }
Line 28:
Line 29: #region Web Form Designer generated code
--- Request Information ---
Full Url: http://localhost/wwWebstore/admin/ErrorTestPage.aspx
IP: 127.0.0.1
Referer: http://localhost/wwWebstore/admin/
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR
1.1.4322; .NET CLR 1.2.30703)
Login: RASNOTEBOOK\rstrahl

Note on the server the source code won't be there so it can't be
retrieved.+++ Rick ---
--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/blog/
----------------------------------
Making waves on the Web
"Larry Tate" <dw********@yahoo.com> wrote in message
news:Oy**************@TK2MSFTNGP09.phx.gbl...
I am wanting to get those cool html error pages that ms produces when I hit an error in asp.net. For instance, when I get a compilation error I get an
html error page that shows me the

Description:
Compiler Error Message:
Source Error:
Source File:

The main thing I want is the Source Error. This give me a few lines of the
code with line numbers.
The other thing is the Compiler Error. This gives me the, "var1 not
declared" or something, error.

Ideally I would like to shoot the html page to my email.

Is this possible.

FYI .... I have this already in the global file.

Dim ex As Exception = Server.GetLastError()
request.path
ex.Message
ex.StackTrace
ex.Source
Request.Form.ToString()
Request.QueryString.ToString()
ex.TargetSite.ToString()
ex.ToString()

All of which is emailed to me and does not include the line number or the
Compiler Error Message.
Any ideas?

Thanks,
Larry

Nov 18 '05 #2
That looks cool. What methods are you calling to get all of this info? I can
write a parser to chew through it.

Thanks,
Larry

"Rick Strahl [MVP]" <ri********@hotmail.com> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...
Hi Larry,

Yeah, it's possible but you have to do a little work. You can only get this info if you have the source code, which in a production app is unlikely.

I have built an WebErrorHandler class that pretty much does what you're
looking for - it generates a detailed error message and logs it and then
also sends an email out with the info.

To get the info you're looking for, you can look at the Server.StackTrace.
Here's is the key method called Parse from the error handler that takes
common error info and drops it into properties of the WebErrorHandler
object. It includes code to pull the source code if available:
public bool Parse()
{
if (this.LastError == null)
return false;

IsParsed = true;

// *** Use the Inner Exception since that has the actual error info
HttpRequest Request = HttpContext.Current.Request;

this.RawUrl = Request.RawUrl;

if ( LastError is System.IO.FileNotFoundException)
this.ErrorMessage = "File not found: " + LastError.Message;
else
this.ErrorMessage = LastError.Message;

this.Time = DateTime.Now;

if (this.CompactFormat)
return true;

this .StackTrace = LastError.StackTrace;
if (this.RetrieveSourceLines)
{
StringBuilder sb = new StringBuilder(1024);

// *** Try to retrieve Source Code information
StackTrace st = new StackTrace(LastError,true);
StackFrame sf = st.GetFrame(0);
if (sf != null)
{
string Filename = sf.GetFileName();

if (RetrieveSourceLines && Filename != null)
{
int LineNumber = sf.GetFileLineNumber();
if (LineNumber > 0)
{
StreamReader sr = new StreamReader(Filename);

// *** Read over unwanted lines
int x = 0;
for (x = 0; x < LineNumber - 4; x++ )
sr.ReadLine();

sb.Append("--- Code ---\r\n");
sb.AppendFormat("File: {0}\r\n",Filename);
sb.AppendFormat("Method: {0}\r\n\r\n",LastError.TargetSite); sb.AppendFormat("Line {0}: {1}\r\n",x + 1,sr.ReadLine());
sb.AppendFormat("Line {0}: {1}\r\n",x + 2,sr.ReadLine());
sb.AppendFormat("Line {0}: {1}\r\n",x + 3,sr.ReadLine());
sb.AppendFormat("<b>Line {0}: {1}</b>\r\n", x+
4,sr.ReadLine() );
sb.AppendFormat("Line {0}: {1}\r\n",x +5,sr.ReadLine());
sb.AppendFormat("Line {0}: {1}\r\n",x +6,sr.ReadLine());
sb.AppendFormat("Line {0}: {1}\r\n",x +7,sr.ReadLine());

sr.Close();
}
}
}

this.SourceCode = sb.ToString();
}

this.FullUrl =
string.Format("http://{0}{1}",Request.ServerVariables["SERVER_NAME"],Request .RawUrl);
this.IPAddress = Request.UserHostAddress;

if (Request.UrlReferrer != null)
this.Referer = Request.UrlReferrer.ToString();

this.Browser = Request.UserAgent;

if (Request.IsAuthenticated)
this.Login = HttpContext.Current.User.Identity.Name;
else
this.Login = "Anonymous";

if (Request.TotalBytes > 0 && Request.TotalBytes < 2048)
{
this.PostBuffer =
Encoding.GetEncoding(1252).GetString(Request.Binar yRead(Request.TotalBytes)) ;
this.ContentSize = Request.TotalBytes;
}
else if (Request.TotalBytes > 2048) // strip the result
{
this.PostBuffer =
Encoding.GetEncoding(1252).GetString(Request.Binar yRead(2048)) + "...";
this.ContentSize = Request.TotalBytes;
}

return true;

}

The class then wrappers everything up into a single text string that can be logged and emailed but that's pretty trivial. The final result looks
something like this:

/wwWebstore/admin/ErrorTestPage.aspx

Object reference not set to an instance of an object.
on 12/19/2003 8:47:57 pm

--- Stack Trace ---
at Westwind.WebStore.ErrorTestPage.Page_Load(Object sender, EventArgs e) in
d:\projects\wwWebStore\Admin\ErrorTestPage.aspx.cs :line 26
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()

--- Code ---
File: d:\projects\wwWebStore\Admin\ErrorTestPage.aspx.cs
Method: Void Page_Load(System.Object, System.EventArgs)

Line 23:
Line 24: // Now explicitly set this value to null
Line 25: Invoice = null;
<b>Line 26: Invoice.GetBlankRecord();</b>
Line 27: }
Line 28:
Line 29: #region Web Form Designer generated code
--- Request Information ---
Full Url: http://localhost/wwWebstore/admin/ErrorTestPage.aspx
IP: 127.0.0.1
Referer: http://localhost/wwWebstore/admin/
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR
1.1.4322; .NET CLR 1.2.30703)
Login: RASNOTEBOOK\rstrahl

Note on the server the source code won't be there so it can't be
retrieved.+++ Rick ---
--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/blog/
----------------------------------
Making waves on the Web
"Larry Tate" <dw********@yahoo.com> wrote in message
news:Oy**************@TK2MSFTNGP09.phx.gbl...
I am wanting to get those cool html error pages that ms produces when I

hit
an error in asp.net. For instance, when I get a compilation error I get an html error page that shows me the

Description:
Compiler Error Message:
Source Error:
Source File:

The main thing I want is the Source Error. This give me a few lines of the code with line numbers.
The other thing is the Compiler Error. This gives me the, "var1 not
declared" or something, error.

Ideally I would like to shoot the html page to my email.

Is this possible.

FYI .... I have this already in the global file.

Dim ex As Exception = Server.GetLastError()
request.path
ex.Message
ex.StackTrace
ex.Source
Request.Form.ToString()
Request.QueryString.ToString()
ex.TargetSite.ToString()
ex.ToString()

All of which is emailed to me and does not include the line number or the Compiler Error Message.
Any ideas?

Thanks,
Larry


Nov 18 '05 #3

Ah, sorry forgot that. Server.GetLastError() and then use the
InnerException. LastError is basically the Exception that is being parsed
and it's set by the constructor. My class basically parses an exception and
generates the error page from that and then dumps a few of the critical
server vars along with that.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/webblog/
----------------------------------
Making waves on the Web
"Larry Tate" <dw********@yahoo.com> wrote in message
news:OJ**************@tk2msftngp13.phx.gbl...
That looks cool. What methods are you calling to get all of this info? I can write a parser to chew through it.

Thanks,
Larry

"Rick Strahl [MVP]" <ri********@hotmail.com> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...
Hi Larry,

Yeah, it's possible but you have to do a little work. You can only get this
info if you have the source code, which in a production app is unlikely.

I have built an WebErrorHandler class that pretty much does what you're
looking for - it generates a detailed error message and logs it and then
also sends an email out with the info.

To get the info you're looking for, you can look at the Server.StackTrace.
Here's is the key method called Parse from the error handler that takes
common error info and drops it into properties of the WebErrorHandler
object. It includes code to pull the source code if available:
public bool Parse()
{
if (this.LastError == null)
return false;

IsParsed = true;

// *** Use the Inner Exception since that has the actual error info
HttpRequest Request = HttpContext.Current.Request;

this.RawUrl = Request.RawUrl;

if ( LastError is System.IO.FileNotFoundException)
this.ErrorMessage = "File not found: " + LastError.Message;
else
this.ErrorMessage = LastError.Message;

this.Time = DateTime.Now;

if (this.CompactFormat)
return true;

this .StackTrace = LastError.StackTrace;
if (this.RetrieveSourceLines)
{
StringBuilder sb = new StringBuilder(1024);

// *** Try to retrieve Source Code information
StackTrace st = new StackTrace(LastError,true);
StackFrame sf = st.GetFrame(0);
if (sf != null)
{
string Filename = sf.GetFileName();

if (RetrieveSourceLines && Filename != null)
{
int LineNumber = sf.GetFileLineNumber();
if (LineNumber > 0)
{
StreamReader sr = new StreamReader(Filename);

// *** Read over unwanted lines
int x = 0;
for (x = 0; x < LineNumber - 4; x++ )
sr.ReadLine();

sb.Append("--- Code ---\r\n");
sb.AppendFormat("File: {0}\r\n",Filename);
sb.AppendFormat("Method:

{0}\r\n\r\n",LastError.TargetSite);
sb.AppendFormat("Line {0}: {1}\r\n",x + 1,sr.ReadLine());
sb.AppendFormat("Line {0}: {1}\r\n",x + 2,sr.ReadLine());
sb.AppendFormat("Line {0}: {1}\r\n",x + 3,sr.ReadLine());
sb.AppendFormat("<b>Line {0}: {1}</b>\r\n", x+
4,sr.ReadLine() );
sb.AppendFormat("Line {0}: {1}\r\n",x +5,sr.ReadLine());
sb.AppendFormat("Line {0}: {1}\r\n",x +6,sr.ReadLine());
sb.AppendFormat("Line {0}: {1}\r\n",x +7,sr.ReadLine());

sr.Close();
}
}
}

this.SourceCode = sb.ToString();
}

this.FullUrl =

string.Format("http://{0}{1}",Request.ServerVariables["SERVER_NAME"],Request
.RawUrl);
this.IPAddress = Request.UserHostAddress;

if (Request.UrlReferrer != null)
this.Referer = Request.UrlReferrer.ToString();

this.Browser = Request.UserAgent;

if (Request.IsAuthenticated)
this.Login = HttpContext.Current.User.Identity.Name;
else
this.Login = "Anonymous";

if (Request.TotalBytes > 0 && Request.TotalBytes < 2048)
{
this.PostBuffer =

Encoding.GetEncoding(1252).GetString(Request.Binar yRead(Request.TotalBytes))
;
this.ContentSize = Request.TotalBytes;
}
else if (Request.TotalBytes > 2048) // strip the result
{
this.PostBuffer =
Encoding.GetEncoding(1252).GetString(Request.Binar yRead(2048)) + "...";
this.ContentSize = Request.TotalBytes;
}

return true;

}

The class then wrappers everything up into a single text string that can

be
logged and emailed but that's pretty trivial. The final result looks
something like this:

/wwWebstore/admin/ErrorTestPage.aspx

Object reference not set to an instance of an object.
on 12/19/2003 8:47:57 pm

--- Stack Trace ---
at Westwind.WebStore.ErrorTestPage.Page_Load(Object sender, EventArgs

e)
in
d:\projects\wwWebStore\Admin\ErrorTestPage.aspx.cs :line 26
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()

--- Code ---
File: d:\projects\wwWebStore\Admin\ErrorTestPage.aspx.cs
Method: Void Page_Load(System.Object, System.EventArgs)

Line 23:
Line 24: // Now explicitly set this value to null
Line 25: Invoice = null;
<b>Line 26: Invoice.GetBlankRecord();</b>
Line 27: }
Line 28:
Line 29: #region Web Form Designer generated code
--- Request Information ---
Full Url: http://localhost/wwWebstore/admin/ErrorTestPage.aspx
IP: 127.0.0.1
Referer: http://localhost/wwWebstore/admin/
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR
1.1.4322; .NET CLR 1.2.30703)
Login: RASNOTEBOOK\rstrahl

Note on the server the source code won't be there so it can't be
retrieved.+++ Rick ---
--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/blog/
----------------------------------
Making waves on the Web
"Larry Tate" <dw********@yahoo.com> wrote in message
news:Oy**************@TK2MSFTNGP09.phx.gbl...
I am wanting to get those cool html error pages that ms produces when
I hit
an error in asp.net. For instance, when I get a compilation error I

get an html error page that shows me the

Description:
Compiler Error Message:
Source Error:
Source File:

The main thing I want is the Source Error. This give me a few lines of the code with line numbers.
The other thing is the Compiler Error. This gives me the, "var1 not
declared" or something, error.

Ideally I would like to shoot the html page to my email.

Is this possible.

FYI .... I have this already in the global file.

Dim ex As Exception = Server.GetLastError()
request.path
ex.Message
ex.StackTrace
ex.Source
Request.Form.ToString()
Request.QueryString.ToString()
ex.TargetSite.ToString()
ex.ToString()

All of which is emailed to me and does not include the line number or the Compiler Error Message.
Any ideas?

Thanks,
Larry



Nov 18 '05 #4
I hate to keep asking questions on this .... :(

How do I implement this? The main reason I ask is because I am using vb.net.
I should be able to convert it..
Also the function is a boolean with no input.

Do I just call this from like the global.asax file?
sub application_error(sender As Object, e As EventArgs)
Parse()
end sub
Thanks,
Hate to be such a pain.
Larry
"Rick Strahl [MVP]" <ri********@hotmail.com> wrote in message
news:ex**************@TK2MSFTNGP12.phx.gbl...

Ah, sorry forgot that. Server.GetLastError() and then use the
InnerException. LastError is basically the Exception that is being parsed
and it's set by the constructor. My class basically parses an exception and generates the error page from that and then dumps a few of the critical
server vars along with that.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/webblog/
----------------------------------
Making waves on the Web
"Larry Tate" <dw********@yahoo.com> wrote in message
news:OJ**************@tk2msftngp13.phx.gbl...
That looks cool. What methods are you calling to get all of this info? I can
write a parser to chew through it.

Thanks,
Larry

"Rick Strahl [MVP]" <ri********@hotmail.com> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...
Hi Larry,

Yeah, it's possible but you have to do a little work. You can only get

this
info if you have the source code, which in a production app is unlikely.
I have built an WebErrorHandler class that pretty much does what you're looking for - it generates a detailed error message and logs it and then also sends an email out with the info.

To get the info you're looking for, you can look at the Server.StackTrace. Here's is the key method called Parse from the error handler that takes common error info and drops it into properties of the WebErrorHandler
object. It includes code to pull the source code if available:
public bool Parse()
{
if (this.LastError == null)
return false;

IsParsed = true;

// *** Use the Inner Exception since that has the actual error info
HttpRequest Request = HttpContext.Current.Request;

this.RawUrl = Request.RawUrl;

if ( LastError is System.IO.FileNotFoundException)
this.ErrorMessage = "File not found: " + LastError.Message;
else
this.ErrorMessage = LastError.Message;

this.Time = DateTime.Now;

if (this.CompactFormat)
return true;

this .StackTrace = LastError.StackTrace;
if (this.RetrieveSourceLines)
{
StringBuilder sb = new StringBuilder(1024);

// *** Try to retrieve Source Code information
StackTrace st = new StackTrace(LastError,true);
StackFrame sf = st.GetFrame(0);
if (sf != null)
{
string Filename = sf.GetFileName();

if (RetrieveSourceLines && Filename != null)
{
int LineNumber = sf.GetFileLineNumber();
if (LineNumber > 0)
{
StreamReader sr = new StreamReader(Filename);

// *** Read over unwanted lines
int x = 0;
for (x = 0; x < LineNumber - 4; x++ )
sr.ReadLine();

sb.Append("--- Code ---\r\n");
sb.AppendFormat("File: {0}\r\n",Filename);
sb.AppendFormat("Method:

{0}\r\n\r\n",LastError.TargetSite);
sb.AppendFormat("Line {0}: {1}\r\n",x + 1,sr.ReadLine()); sb.AppendFormat("Line {0}: {1}\r\n",x + 2,sr.ReadLine()); sb.AppendFormat("Line {0}: {1}\r\n",x + 3,sr.ReadLine()); sb.AppendFormat("<b>Line {0}: {1}</b>\r\n", x+
4,sr.ReadLine() );
sb.AppendFormat("Line {0}: {1}\r\n",x +5,sr.ReadLine()); sb.AppendFormat("Line {0}: {1}\r\n",x +6,sr.ReadLine()); sb.AppendFormat("Line {0}: {1}\r\n",x +7,sr.ReadLine());
sr.Close();
}
}
}

this.SourceCode = sb.ToString();
}

this.FullUrl =

string.Format("http://{0}{1}",Request.ServerVariables["SERVER_NAME"],Request
.RawUrl);
this.IPAddress = Request.UserHostAddress;

if (Request.UrlReferrer != null)
this.Referer = Request.UrlReferrer.ToString();

this.Browser = Request.UserAgent;

if (Request.IsAuthenticated)
this.Login = HttpContext.Current.User.Identity.Name;
else
this.Login = "Anonymous";

if (Request.TotalBytes > 0 && Request.TotalBytes < 2048)
{
this.PostBuffer =

Encoding.GetEncoding(1252).GetString(Request.Binar yRead(Request.TotalBytes))
;
this.ContentSize = Request.TotalBytes;
}
else if (Request.TotalBytes > 2048) // strip the result
{
this.PostBuffer =
Encoding.GetEncoding(1252).GetString(Request.Binar yRead(2048)) + "..."; this.ContentSize = Request.TotalBytes;
}

return true;

}

The class then wrappers everything up into a single text string that can
be
logged and emailed but that's pretty trivial. The final result looks
something like this:

/wwWebstore/admin/ErrorTestPage.aspx

Object reference not set to an instance of an object.
on 12/19/2003 8:47:57 pm

--- Stack Trace ---
at Westwind.WebStore.ErrorTestPage.Page_Load(Object sender,
EventArgs
e)
in
d:\projects\wwWebStore\Admin\ErrorTestPage.aspx.cs :line 26
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()

--- Code ---
File: d:\projects\wwWebStore\Admin\ErrorTestPage.aspx.cs
Method: Void Page_Load(System.Object, System.EventArgs)

Line 23:
Line 24: // Now explicitly set this value to null
Line 25: Invoice = null;
<b>Line 26: Invoice.GetBlankRecord();</b>
Line 27: }
Line 28:
Line 29: #region Web Form Designer generated code
--- Request Information ---
Full Url: http://localhost/wwWebstore/admin/ErrorTestPage.aspx
IP: 127.0.0.1
Referer: http://localhost/wwWebstore/admin/
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET
CLR 1.1.4322; .NET CLR 1.2.30703)
Login: RASNOTEBOOK\rstrahl

Note on the server the source code won't be there so it can't be
retrieved.+++ Rick ---
--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/blog/
----------------------------------
Making waves on the Web
"Larry Tate" <dw********@yahoo.com> wrote in message
news:Oy**************@TK2MSFTNGP09.phx.gbl...
> I am wanting to get those cool html error pages that ms produces

when I hit
> an error in asp.net. For instance, when I get a compilation error I

get
an
> html error page that shows me the
>
> Description:
> Compiler Error Message:
> Source Error:
> Source File:
>
> The main thing I want is the Source Error. This give me a few lines

of the
> code with line numbers.
> The other thing is the Compiler Error. This gives me the, "var1 not
> declared" or something, error.
>
> Ideally I would like to shoot the html page to my email.
>
> Is this possible.
>
> FYI .... I have this already in the global file.
>
> Dim ex As Exception = Server.GetLastError()
> request.path
> ex.Message
> ex.StackTrace
> ex.Source
> Request.Form.ToString()
> Request.QueryString.ToString()
> ex.TargetSite.ToString()
> ex.ToString()
>
> All of which is emailed to me and does not include the line number
or the
> Compiler Error Message.
>
>
> Any ideas?
>
> Thanks,
> Larry
>
>



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a....
3
by: Jas Shultz | last post by:
I'm using Win2K3 Enterprise edition with the latest .NET framework installed. I have this problem with getting "out of disk space" errors. It...
0
by: Donald Watson | last post by:
I have created data access pages for my database that is sitting in a shared folder on the network so all my users have access to it. Everything...
6
by: Binoy | last post by:
Hello, I am getting this error once in a while from my web sites. When I will refresh web browser, it goes off and sites are working fine. ...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following...
6
by: David Lozzi | last post by:
Hello there, I'm getting the following error System.NullReferenceException: Object reference not set to an instance of an object. at...
3
by: Tom | last post by:
I'm building a web application using VS 2005. This application uses Windows authentication to 'authenticate'. However, when I test it (debug) via...
2
by: Andrew Cooper | last post by:
Greetings, I've got a website that has several pages with DataGrid controls on them. The controls are bound to Object Datasources. On one of...
4
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.