Wrox Programmer Forums
|
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 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
 
Old January 22nd, 2013, 07:09 PM
Registered User
 
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
 
Old January 22nd, 2013, 07:57 PM
Registered User
 
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
 
Old January 25th, 2013, 03:56 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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!





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





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