By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,506 Members | 1,876 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,506 IT Pros & Developers. It's quick & easy.

Error Handling not Working ASP.NET

P: n/a
Rob
Thank you in advance for your help.
I have a response.redirect in my global.asax.vb file to redirect to
err.aspx page, upon an error the redirect works fine but in the
err.aspx all I simply want to do is write out the error for now and do
a bunch of other stuff later, but with the following code, everytime
the whole web app freezes up and just sits there and nothing happens!!
dim objerr As Exception = Server.GetLastError.GetBaseException
Response.Write(objerr.Message.ToString)
Server.ClearError()
is there too much info in the objerror? (I created a sql error on
purpose so all the error should say is Invalid Table name)
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I'm guessing youre getting stuck in an endless loop, since something in
your error handler is throwing an error.

Try something like this:

Dim objErr as Exception = Server.GetLastError()
if (objErr <> null) then
' You could perform some loop in here to iterate through the
' innerExceptions to get even further into the problem.
Response.Write(objErr.Message)
Server.ClearError()
end if

--
Matt Berther
http://www.mattberther.com

Rob wrote:
Thank you in advance for your help.
I have a response.redirect in my global.asax.vb file to redirect to
err.aspx page, upon an error the redirect works fine but in the
err.aspx all I simply want to do is write out the error for now and do
a bunch of other stuff later, but with the following code, everytime
the whole web app freezes up and just sits there and nothing happens!!
dim objerr As Exception = Server.GetLastError.GetBaseException
Response.Write(objerr.Message.ToString)
Server.ClearError()
is there too much info in the objerror? (I created a sql error on
purpose so all the error should say is Invalid Table name)

Nov 18 '05 #2

P: n/a
Rob
Matt unfortunately this did not work, same result, why would my code
get it stuck in a loop in the first place?

Matt Berther <mb******@hotmail.com> wrote in message news:<u9**************@tk2msftngp13.phx.gbl>...
I'm guessing youre getting stuck in an endless loop, since something in
your error handler is throwing an error.

Try something like this:

Dim objErr as Exception = Server.GetLastError()
if (objErr <> null) then
' You could perform some loop in here to iterate through the
' innerExceptions to get even further into the problem.
Response.Write(objErr.Message)
Server.ClearError()
end if

--
Matt Berther
http://www.mattberther.com

Rob wrote:
Thank you in advance for your help.
I have a response.redirect in my global.asax.vb file to redirect to
err.aspx page, upon an error the redirect works fine but in the
err.aspx all I simply want to do is write out the error for now and do
a bunch of other stuff later, but with the following code, everytime
the whole web app freezes up and just sits there and nothing happens!!
dim objerr As Exception = Server.GetLastError.GetBaseException
Response.Write(objerr.Message.ToString)
Server.ClearError()
is there too much info in the objerror? (I created a sql error on
purpose so all the error should say is Invalid Table name)

Nov 18 '05 #3

P: n/a
Your code could easily get stuck in a loop in the error handler...

ie: any unhandled exception goes to Application_Error, including any
exceptions thrown in Application_Error.

I've been bitten by this a few times. ;) Best thing to do, is check for
nulls where you can and put a try/catch around everything. An error in
the error handler is pretty pointless.

--
Matt Berther
http://www.mattberther.com

Rob wrote:
Matt unfortunately this did not work, same result, why would my code
get it stuck in a loop in the first place?

Matt Berther <mb******@hotmail.com> wrote in message news:<u9**************@tk2msftngp13.phx.gbl>...
I'm guessing youre getting stuck in an endless loop, since something in
your error handler is throwing an error.

Try something like this:

Dim objErr as Exception = Server.GetLastError()
if (objErr <> null) then
' You could perform some loop in here to iterate through the
' innerExceptions to get even further into the problem.
Response.Write(objErr.Message)
Server.ClearError()
end if

--
Matt Berther
http://www.mattberther.com

Rob wrote:
Thank you in advance for your help.
I have a response.redirect in my global.asax.vb file to redirect to
err.aspx page, upon an error the redirect works fine but in the
err.aspx all I simply want to do is write out the error for now and do
a bunch of other stuff later, but with the following code, everytime
the whole web app freezes up and just sits there and nothing happens!!
dim objerr As Exception = Server.GetLastError.GetBaseException
Response.Write(objerr.Message.ToString)
Server.ClearError()
is there too much info in the objerror? (I created a sql error on
purpose so all the error should say is Invalid Table name)

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.