Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7676483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:12:35+00:00 2026-05-31T17:12:35+00:00

So I read up on this method called PRG as a way of addressing

  • 0

So I read up on this method called PRG as a way of addressing the form double-submit issue. However, I have yet to find a descent implementation of the Summary Page / Success Message displayed to the user. The only way I can think of is storing a session variable, but I don’t want it to persist on multiple refreshes. It should show the message/summary once, and be done. Furthermore, it would be ideal if the user could not return to the previously submitted page.

Here is my PRG Code:

Protected Sub InsertRequest() Handles wizard.FinishButtonClick
    Using connection As New SqlConnection(connectionStr)
        Dim insertQuery As New SqlCommand("spInsertRequest", connection)
        insertQuery.CommandType = CommandType.StoredProcedure

        '1 - SETUP SQL PARAMETERS (omitted for brevity)

        '2 - POST (inserts record into DB)
        Try
            connection.Open()
            insertQuery.ExecuteNonQuery()
            connection.Close()
        Catch ex As Exception
            Logger.WriteToErrorLog(Me, ex.Source, ex.Message, ex.StackTrace)
        End Try

    '3 - REDIRECT (to the same page and...)
    Try
        Dim urlRedirect As String = If(IsNothing(Request.Url), "", IO.Path.GetFileName(Request.Url.AbsolutePath)) 'Gets the filename of the current page.
        If Not String.IsNullOrEmpty(urlRedirect) Then
            Session.Add("referrerPage", urlRedirect) 'Used for identifying when the page is being redirected back to itself.
            PageExt.AddParam(urlRedirect, "id", recID.ToString)
            Response.Redirect(urlRedirect)
        End If
    Catch ex As Exception
        Logger.WriteToErrorLog(Me, ex.Source, ex.Message, ex.StackTrace)
    End Try
End Sub

'4 - GET (Display 'Success' message/summary here)

The question is, how to display this message on the redirect which directly results from the submit, and preferably not for any further refreshes? Or just simply display the message regardless of refreshes, whatever is easiest and makes the most sense. Thanks 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:12:36+00:00Added an answer on May 31, 2026 at 5:12 pm

    The trick to having messages like this displayed only once is to use the concept of “flash” session data.

    The way this usually works is to store the “message” (or whatever other data related to the “success” that you need) in the session prior to the redirect. Then, when processing the redirect, make sure to remove the flash data from the session prior to sending the “success page” response.

    This way, if the user tries to come back to the success page, the flash data will not be in the session to be picked up, so you won’t have it displayed twice. To be nice to the users, you can check for the flash data to be missing and display a nice error message if they try to get to the success page outside of the Post-Redirect-Get flow.

    This is exactly what the Grails framework (in the Groovy world) does and it works very well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose that I have a method called doSomething() and I want to use this
In my rails application my models have a to_html method. This method is called
I have code like this: public form() { InitializeComponent(); init(); //read ini and try
I have a method which save settings to file. This method is called if
I read in more than one website about this method of protecting forms: I
I've read some posts stating that using this method is not good, shouldn't be
I have this little crazy method that converts BigDecimal values into nice and readable
I have this method in my videos controller: def notification_go current_user.render_read respond_to do |format|
I have read several of the post about Objective-C method syntax but I guess
Running CF 9,0,1,274733 I have a custom DAO CFC with a method called getGamesBetTypesID().

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.