Page upload data again on page refresh in ASP.NET

Posted by Etienne on Stack Overflow See other posts from Stack Overflow or by Etienne
Published on 2010-02-21T08:14:32Z Indexed on 2010/03/12 0:57 UTC
Read the original article Hit count: 381

Filed under:
|
|

For some reason when the user click on the submit button and he re-fresh the page the same data get's uploaded again to my SQL Server 2005 database. I do not what this to happen........... Why is this happening? I am making use of a SQL Data Source!!

My code

 Try

        'See if user typed the correct code.
        If Me.txtSecurity.Text = Session("Captcha") Then

            If Session("NotifyMe") = "Yes" Then
                SendEmailNS()
            End If

            RaterRate.Insert()
            RaterRate.Update()

            DisableItems()

            lblResultNS.Text = "Thank you for leaving a comment"

            LoadCompanyList()
            LoadRateRecords()

            txtCommentNS.Text = ""
            txtSecurity.Text = ""
            lblResultNS.Focus()

        Else

            Session("Captcha") = GenerateCAPTCHACode()
            txtSecurity.Text = ""
            txtSecurity.Focus()
            Validator10.Validate()

        End If


    Catch ex As Exception

        lblResultNS.Visible = True     
        lblResultNS.Text = ex.Message.ToString
        lblResultNS.Focus()

    End Try

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sql