Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Prevent resending information on refresh

Prevent resending information on refresh

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-netdatabase
12 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B benams

    Hi, I have an asp.net page with a send button. when I hit that button, I send some information to the DataBase. When I try to refresh the page I'm asked to resend the inforamtion or to cancel the refresh. as a result, I get multiple rows in the database... how can I refresh the page and prevent the resending of the info?

    N Offline
    N Offline
    nagendrathecoder
    wrote on last edited by
    #3

    Why u want to refresh the page? If u are doing this to clear form fields, then u can do it in send button itself. If there is any specific reason then above solution is good one. :)

    1 Reply Last reply
    0
    • P padmanabhan N

      create one primary key in that database so that it will return eror message that duplicate column, capture that error and throw user friendly error message....... [or] disable refresh and f5 button....

      Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

      modified on Tuesday, August 25, 2009 8:00 AM

      B Offline
      B Offline
      benams
      wrote on last edited by
      #4

      I don't think it's a right solution for my problem. I want to allow users send some duplicate info, but I dont want it to happen automatically when they refresh the page.

      P 1 Reply Last reply
      0
      • B benams

        I don't think it's a right solution for my problem. I want to allow users send some duplicate info, but I dont want it to happen automatically when they refresh the page.

        P Offline
        P Offline
        padmanabhan N
        wrote on last edited by
        #5

        why do you want to refresh the page... any specific reason or any requirement......

        Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

        1 Reply Last reply
        0
        • B benams

          Hi, I have an asp.net page with a send button. when I hit that button, I send some information to the DataBase. When I try to refresh the page I'm asked to resend the inforamtion or to cancel the refresh. as a result, I get multiple rows in the database... how can I refresh the page and prevent the resending of the info?

          V Offline
          V Offline
          Vasudevan Deepak Kumar
          wrote on last edited by
          #6

          You can actually target submission into an IFRAME through an intermediate handler page. The response back from the handler page, manipulated by a JavaScript function can control the response. That way you get to show some progress of submission of the form as well.

          Vasudevan Deepak Kumar Personal Homepage
          Tech Gossips
          The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep!

          1 Reply Last reply
          0
          • B benams

            Hi, I have an asp.net page with a send button. when I hit that button, I send some information to the DataBase. When I try to refresh the page I'm asked to resend the inforamtion or to cancel the refresh. as a result, I get multiple rows in the database... how can I refresh the page and prevent the resending of the info?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #7

            Hi , Put ur code of page load I hope this will help u out if (Page.IsPostBack == false) { } Thanks , Amit Patel

            1 Reply Last reply
            0
            • B benams

              Hi, I have an asp.net page with a send button. when I hit that button, I send some information to the DataBase. When I try to refresh the page I'm asked to resend the inforamtion or to cancel the refresh. as a result, I get multiple rows in the database... how can I refresh the page and prevent the resending of the info?

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #8

              benams wrote:

              how can I refresh the page and prevent the resending of the info? Quote Selected Text

              By redirecting to a page. When you redirect, browser will clear the post data from it's cache.

              Navaneeth How to use google | Ask smart questions

              B 1 Reply Last reply
              0
              • N N a v a n e e t h

                benams wrote:

                how can I refresh the page and prevent the resending of the info? Quote Selected Text

                By redirecting to a page. When you redirect, browser will clear the post data from it's cache.

                Navaneeth How to use google | Ask smart questions

                B Offline
                B Offline
                benams
                wrote on last edited by
                #9

                I mean when the user hit the refresh button of his web browser...

                A 1 Reply Last reply
                0
                • B benams

                  I mean when the user hit the refresh button of his web browser...

                  A Offline
                  A Offline
                  Abhijit Jana
                  wrote on last edited by
                  #10

                  benams wrote:

                  I mean when the user hit the refresh button of his web browser..

                  You can restrict user to click on Refresh Button on Browser. The think you need to do is you have to check the Post back of Page. On Page Load,

                  If(Page.ISPostBack)
                  {
                  // Store Db data into Database.
                  }

                  And After that Reset All the field.

                  Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

                  1 Reply Last reply
                  0
                  • B benams

                    Hi, I have an asp.net page with a send button. when I hit that button, I send some information to the DataBase. When I try to refresh the page I'm asked to resend the inforamtion or to cancel the refresh. as a result, I get multiple rows in the database... how can I refresh the page and prevent the resending of the info?

                    A Offline
                    A Offline
                    Abhijit Jana
                    wrote on last edited by
                    #11

                    Please read my last reply in this thread for Answer.

                    Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

                    1 Reply Last reply
                    0
                    • B benams

                      Hi, I have an asp.net page with a send button. when I hit that button, I send some information to the DataBase. When I try to refresh the page I'm asked to resend the inforamtion or to cancel the refresh. as a result, I get multiple rows in the database... how can I refresh the page and prevent the resending of the info?

                      D Offline
                      D Offline
                      droth17
                      wrote on last edited by
                      #12

                      I created a new class that my page inherits from that basically adds a session variable and a form field and then tracks the two to see if the user hit the F5 button. There is a article on it here in code project somewhere (I didn't create the original, but modified to fit my needs), I just can't seem to find the link. You could also look at other solutions like. http://aspalliance.com/687_Preventing_Duplicate_Record_Insertion_on_Page_Refresh.4[^] and http://forums.asp.net/t/763984.aspx?PageIndex=2[^]

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups