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 7th, 2013, 03:33 PM
Friend of Wrox
 
Join Date: Mar 2011
Posts: 126
Thanks: 39
Thanked 2 Times in 2 Posts
Default (Ch. 15)- p.564 - Display friendly msg?

Hi Imar,

Just wondering if it makes sense to add a friendly message of some sort for the case if a review does = null (
Quote:
Your cleints may have a bookmark for a page with a specific ID in the query string.....the review can't be found and a so called Null Reference exception occurs.
)

Is it common practice to add some sort of friendly message for this case?

Thank you.
Tulsi
 
Old January 8th, 2013, 04:03 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes; what you want to do is this:

1. Check if the instance is null
2. If it is, display a message to the user (by making a Panel visible for example) that explains the item cannot be found.
3. Set the Status code of the Response to 404. This marks the item as "Not Found" which tells search engines they can stop requesting that page. Chapter 18, page 693 has sample code on how to do this.

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!
 
Old January 8th, 2013, 01:27 PM
Friend of Wrox
 
Join Date: Mar 2011
Posts: 126
Thanks: 39
Thanked 2 Times in 2 Posts
Default

Thank you. I will try this out.

Tulsi





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Msg 128, Level 15, State 1 paulw4 SQL Server 2005 7 February 25th, 2009 04:51 AM
Server: Msg 128, Level 15, State 1, Line 3 amit.jagtap SQL Server 2005 1 August 9th, 2007 08:50 AM
how to display error msg in custom ctrl anirosek ASP.NET 1.0 and 1.1 Basics 1 July 25th, 2007 09:34 AM
Display a msg when waiting 4 output from database Sach Classic ASP Basics 2 April 29th, 2004 08:24 PM
msg display before starting job msrnivas .NET Web Services 7 March 14th, 2004 09:26 PM





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