Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Beginning ASP.NET 4.5 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 6th, 2014, 07:30 PM
Authorized User
Points: 416, Level: 7
Points: 416, Level: 7 Points: 416, Level: 7 Points: 416, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
Default Ch 18 Global exception handling

Hi Imar,

I successfully made it through the 1st 2 Try It Out exercises for handling exceptions and global exceptions. But in order to see my Global Exception page (OtherErrors.aspx) I forced an error in the system by commenting out the web.config system.net element (the smpt deliveryMethod stuff). This led to several findings I'd like to get your input on:

1 - The global.asax also uses the mail system, so I had to comment out the send mail command there. But it raised a question of Try-Catch in global.asax. It's probably an academic issue since we need to not have errors in the error handling method, but...

Is that VB (or C#) coding in the global.asax file? And can a Try-Catch be implemented there? Wouldn't that be desirable in order to avoid legitimate errors such as the mail server is down, etc.?

2 - Even after I commented out the induced mail system error in global.asax, I ended up with what I believe is an AJAX script error. The 1st line of the file is: // Name: MicrosoftAjaxWebForms.debug.js

The error was Line: 885
"Error: Sys.WebForms.PageRequestManagerParserErrorExceptio n: The message received from the server could not be parsed."

If I change the web.config <customErrors> element to NOT include "redirectMode="ResponseRewrite", then I don't get the script error and my OtherErrors.aspx appears without error.

Can you explain what's happening there?

I know that's a lot of "cross wiring", but I'm trusting you'll be familiar with it and have some guidance about what I observed.

I just wanted to see OtherErrors.aspx invoked; it turned into more than I expected.

Thanks.

Best Regards,
Alan
Reply With Quote
  #2 (permalink)  
Old February 9th, 2014, 08:17 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Alan,

Quote:
But it raised a question of Try-Catch in global.asax.
Yes, good idea to use try/catch there to prevent errors when sending the mail. In the catch you could try to write to a text file (in another try/catch block) to log the error in case the mail server is down.

Quote:
Is that VB (or C#) coding in the global.asax file?
It can be both, but it needs to be the same language as the rest of the site.

Quote:
Can you explain what's happening there?
Nope, no idea what's going on.

Quote:
I just wanted to see OtherErrors.aspx invoked; it turned into more than I expected.
You can just throw an exception from an existing page to raise an exception.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
AlanWheeler (February 9th, 2014)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 18 - Try it out: Handling Exceptions Site Wide (OtherErrors.aspx) Tulsi BOOK: Beginning ASP.NET 4 : in C# and VB 0 October 9th, 2013 09:24 AM
Ch 18 - Try it out: Handling Exceptions Site Wide (OtherErrors.aspx) Tulsi BOOK: Beginning ASP.NET 4 : in C# and VB 0 October 9th, 2013 09:21 AM
ch 18 - Try It out: Handling Exceptions Site Wide Tulsi BOOK: Beginning ASP.NET 4 : in C# and VB 10 September 12th, 2013 01:30 PM
Exception Handling Tip - Ch. 18, p.695 Tulsi BOOK: Beginning ASP.NET 4 : in C# and VB 5 June 6th, 2013 10:34 AM
Exception Handling Global Aspx Fed BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 11 February 22nd, 2010 06:34 AM



All times are GMT -4. The time now is 05:10 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.