title: Can I handle PostBack and refresh differently?
body: <p>This is a general question I haven't seen an answer for.</p>
  
  <p>Can I tell the difference between <code>PostBack</code> and refresh in code to ensure people don't submit the same item repeatedly?</p>
  
  <p>Application is C# based ASP.NET. Code below:</p>
  
  <pre><code>protected void SubmitListItem(object sender, EventArgs e)
  {
      if (Page.IsPostBack) //Fires on both submit and F5
      {
          SPUser user = web.CurrentUser;
          string alias = user.Email.Substring(0, user.Email.IndexOf('@'));
          if (ListChoice.SelectedItem.Text == "comment")
          {
              SPList TargetList = web.Lists.TryGetList("Offer Comments");
              SPListItem item = TargetList.Items.Add();
              item["Title"] = TitleBox.Text;
              item["Body"] = BodyBox.Text;
              item["OfferID"] = OfferID;
              item["Alias"] = alias;
              item.SystemUpdate();
              TargetList.Update();
              LoadOffers();
          }
          else
          {
              SPList TargetList = web.Lists.TryGetList("Offer Best Practices");
              SPListItem item = TargetList.Items.Add();
              item["Title"] = TitleBox.Text;
              item["Body"] = BodyBox.Text;
              item["OfferID"] = OfferID;
              item.SystemUpdate();
              TargetList.Update();
              LoadOffers();
          }
      }
  }
  </code></pre>