post-redirect-get

How do I use the "Post/Redirect/Get" a.k.a. "Redirect after Post" with asp.net

Doing a refresh after certain action in asp.net seems to make them happen again even when that action doesn't make sense (think double delete). The web way to deal with this situation is to redirect after a post to get a clean version of the page that can be refreshed without reposting an action to the webserver. How can I do this with ...

How do I implement the Post/Redirect/Get pattern in asp.net WebForms?

So I understand the basics of the prg pattern. But I haven't come across a technique for making arbitrary data available to the "get" instance of a page. For example, I might want to display different feedback messages to the user depending on their action which initiated the PostBack. What I've been doing is sending an identifier as ...

How to display messages to the user after a POST + HTTP redirect

I’m using the PRG pattern to avoid multiple form submission. It has, however, a serious drawback — you cannot simply echo the confirmation message to the user (obviously, the user won’t see the page, he will be redirected to another one). What are the solutions to this problem? I know two of them, but none of them seems perfect. Use a...

Will redirect avoid double posting?

Probably not but i want to ask. Will redirect avoid double posting? I know there are better ways to avoid it but how do most double post happen? from my understanding its when the current page doesnt load and the user hits refresh, not bc of clicking post multiple times. I figure redirect info are so small that when the user hits refresh...

DIY Form handling, PRG, Validation

I would like to implement form handling for web apps. I'd like to implement PRG (post-redirect-get), as I believe it is the way to go in form handling (plays very nicely with reload and back button). However, I'm seeing that it complicates validation. Basically, when you post, you have the form state (as post parameters). However, if yo...

Subclass of webapp.RequestHandler doesn't have a response attribute

Using the below code, my template loads fine until I submit the from, then I get the following error: e = AttributeError("'ToDo' object has no attribute 'response'",) Why doesn't my ToDo object not have a response attribute? It works the first time it's called. import cgi import os from google.appengine.api import users from google...

Problem with my implementation of the Post/Redirect/Get pattern

I always use the Post/Redirect/Get method on my forms. My forms generally always submit to themselves. However, when I have an error in the form, I don't send any new headers. This is so I can easily do stuff like this <input type="text" name="email" value="<?php echo $this->input->post('email', '') ?>" /> The PHP is just a library fu...

Simple ASP.NET MVC CRUD views opening/closing in JavaScript UI dialog

I have various simple ASP.NET MVC views for CRUD operations which work fine on their own as a simple webpage. I will now integrate them into the website itself (into the content) and have for instance links like "Create new post" which would fire up the view in a chosen Lightbox clone (don't know yet which one, maybe Colorbox or Thickbox...

post/redirect/get

In producing a web-based data entry system, is the fact that you are adding an extra server request per page a significant concern when deciding whether or not to use a post/redirect/get design? ...

Should RenderAction be used with forms?

My setup: Have a view for a route like: /Pages/Details/2 The page details view has <% Html.RenderAction("CreatePageComment", "Comments"); %> to render a comment form Comment form posts to Comments/CreatePageComment /Comments/CreatePageComment returns RedirectToAction when a comment is created successfully This all works nicely My que...

Post/Redirect/Get Pattern in ASP.NET MVC

What is the best practice for implementing the Post/Redirect/Get pattern in ASP.NET MVC? In particular, what is the best way to do this when you want to redirect back to the initial action/controller? Here's how I am currently doing this: Display form to user. In the form, use <%= Html.Hidden("returnUrl") %> In the action, use ViewDa...

asp.net Post/Request/Get question about validation

I'm trying to figure out a logical and quick way to implement the "PRG" design style in a small site I'm doing, and I'm finding an issue I can't think of a good way to solve. I have a form. It has 2 fields (first and last name). When the user submits the form, I check to make sure that they have data in them before I save it to the data...

PRG in ASP.NET MVC but with object data transferred to the redirected action

Following the Post-Redirect-Get pattern as described in various spots but maybe in most detail here by Stephen Walter, I want to use RedirectToAction but it does not accept a parameter for sending an object to it. I can only send route values either as an object or as a RouteValueDictionary. So currently I send object ID and type and pul...

Post/Redirect/Get pattern and sticky forms

I'm using the Post/Redirect/Get pattern on a form of mine. I've never used this approach before and I'm trying to figure something out: Normally, I always just display the posted form again when there are validation errors and display POST values in the form (sticky form). However, with the PRG pattern, the form is displayed after a red...

Redirecting before POST upload has been completed

I have form with file upload. The files to be uploaded actually are pictures and videos, so they can be quite big. I have logic which based on headers and first 1KB can determine if the rest will be processed or immediately rejected. In the later case I'd like to redirect client to error page without having to wait for upload to finish. ...

Post/Redirect/Get in Webkit causes a full page reload

It seems that in Webkit-based browsers (Chrome and Safari) when a Post/Redirect/Get is performed on the server, the entire page (html + images + css, etc.) is redownloaded. It appears the same as if you reloaded the page. There's been a question (and somewhat of a solution) posted in the Google Chrome Help: http://www.google.com/support...

Post-Redirect-Get Model - Data Storage Methods & PCI Compliance

My question is on how to preserve data during the redirect when using the PRG Pattern on my forms. Specifically, I'm wanting to use this in an ecommerce application. I have three options of storing the data over the redirect, and I have concerns with each. I'm hoping you guys may be able to help me work through this issue: 1.) Store...

Is the PRG pattern incompatible with AJAX form posts?

I am using the post-redirect-get pattern for all my forms, but now need to add AJAX functionality to improve the user experience. My initial thoughts are that the two do not mix. In the PRG scenario, I would have my post action that would then either redirect back to my get action if there is a validation error, or redirect to my succes...

Best design pattern for associating subdomain with area and PRG pattern?

Now that the next version of ASP.NET MVC is being prototyped and previewed (ASP.NET MVC 3 Preview 1 came out a couple of weeks ago), I wonder if we should call the attention of the Core Dev team (S Hanselman, Phil Haack and all) to this "feature." Is there a easy/non tacky way of associating subdomains areas? Something like: http://a...

How to achieve Post-Redirect-Get in a Wordpress plugin's admin menu page?

I am writing a Wordpress plugin, which adds an admin menu page. In the page is a form. When the form is submitted, the plugin writes to the database. But then I encounter a problem: whenever the user reloads the page, he/she is asked whether to send the POSTDATA again. If the user clicks yes, the plugin writes to the database again. Aft...