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 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 22nd, 2013, 07:09 PM
Registered User
Points: 27, Level: 1
Points: 27, Level: 1 Points: 27, Level: 1 Points: 27, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 Sample Code Error

Hello,

While trying the sample code in VB on page 210-211 i get an error when i run in the IDE. The program breaks on the line after the End IF right after the throw new Exception line. The error is "exception was unhandled by user code". I cant make the page launch with the custom error that is being shown on page 212. I have set the login page as the startup page. Is there an IDE setting i'm missing. Please help.

Thanks.
--------------------------------------------------
Imports Microsoft.VisualBasic

Public Class Basepage
Inherits System.Web.UI.Page

Public Sub Page_PreRender(sender As Object, e As System.EventArgs) Handles Me.PreRender

If Me.Title = "Untitled Page" Or String.IsNullOrEmpty(Me.Title) Then
Throw New Exception("YOU MUST ENTER A TITLE")
'program breaks right after the above line
End If

End Sub

End Class
---------------------------
Partial Class login
Inherits Basepage

End Class
Reply With Quote
  #2 (permalink)  
Old January 22nd, 2013, 07:57 PM
Registered User
Points: 27, Level: 1
Points: 27, Level: 1 Points: 27, Level: 1 Points: 27, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I ran it with CTRL + F5 and it no longer breaks right after the throw error line. I will assume that this is the expected behavior. Thanks
Reply With Quote
  #3 (permalink)  
Old January 25th, 2013, 03:56 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

>> I will assume that this is the expected behavior.

Indeed. When you run with F5, the site runs in Debug mode and the error is caught by Visual Studio. When you run with Ctrl+F5, you're not in debugging mode, the error is not handled and shows up in the browser.

Cheers,

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
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
Sample Code Error - Chapter 3 Specifying Views mlcmds BOOK: Professional ASP.NET MVC 4 4 June 4th, 2013 03:10 PM
Error Trying to run sample code from chapter 9 mzaretsky99 BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB 0 February 17th, 2011 10:58 PM
Error in Chapter 11 Sample Code josevi BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 1 February 1st, 2008 01:43 PM



All times are GMT -4. The time now is 07:56 PM.


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