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
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 Display Modes
  #1 (permalink)  
Old October 5th, 2011, 01:38 PM
Authorized User
Points: 224, Level: 4
Points: 224, Level: 4 Points: 224, Level: 4 Points: 224, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
  #2 (permalink)  
Old October 5th, 2011, 02:30 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 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!
Reply With Quote
Reply


Thread Tools
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
CHP 14, Now PC and New SqlExpress ssndude BOOK: Beginning ASP.NET 4 : in C# and VB 1 May 7th, 2011 04: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 04:24 PM
Use Remedy client using VB rekha_jsr VB How-To 0 May 3rd, 2007 08:07 AM
Chp 14 e-commerce JamesA BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 September 3rd, 2004 07:14 PM



All times are GMT -4. The time now is 03:34 PM.


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