473,385 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 1790
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. orbitz.com web site uses Lisp for algorithms, etc. b....
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 doesn't happen all the time but it does happen. When...
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 works perfectly. I have 2 data access pages built....
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. Directory structures and file names are as below- ...
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 error message: "The Web server reported...
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 shopping_bag.GetBagTotals()
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 the VS 2005 built-in test server, it doesn't work....
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 the pages I keep getting a "Timeout expired. The...
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 am trying to rebuild code for a working,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.