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 October 5th, 2011, 12:38 PM
Authorized User
 
Join Date: Sep 2011
Posts: 41
Thanks: 3
Thanked 4 Times in 3 Posts
Default Imar: Bug chp 14, please remedy

Imar,

PROBLEM: Chapter 14, ManagePhotoAlbum.aspx. On this page, insert a picture, this works fine. Then click the browser refresh and the same picture is inserted again. Repeat and it happens again.

CONTEXT: I wasn't entirely sure if it was something in my project. So I went to your site: http://aspnet4.planetwrox.com/ and I reproduced the error. If you look at album "testt", the duplicate images were produced by me clicking the browser refresh. To reproduce error, just insert an image and then click the browser refresh.

QUESTIONS: 1) Why does it happen? I looked at the code, life cycle, etc. and conceptually, I don't understand why it happens. 2) Can you provide a fix?

Thank you.
 
Old October 5th, 2011, 01:30 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

It's not a bug, it's by design. When you refresh, the browser will warn you about resubmitting the data, and that if you just made a purchase you should press cancel (that's at least what IE says) to avoid purchasing / paying again. You can work around it by implementing the PRG pattern (Post / Redirect / Get) where you redirect to the same page after saving the data, which issues a GET request for the same page. When users then hit refresh, they execute the GET request again which is harmless. For more info about PRG:

http://www.google.com/#hl=en&cp=21&g...t+get+redirect

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
CHP 14, Now PC and New SqlExpress ssndude BOOK: Beginning ASP.NET 4 : in C# and VB 1 May 7th, 2011 03:11 AM
chp 14: ulysses installation problems DMatt BOOK: Professional PHP6 0 December 9th, 2010 06:28 PM
use Remedy Client through VB rekha_jsr VB Components 1 May 3rd, 2007 03:24 PM
Use Remedy client using VB rekha_jsr VB How-To 0 May 3rd, 2007 07:07 AM
Chp 14 e-commerce JamesA BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 September 3rd, 2004 06:14 PM





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