title: Updates are currently disallowed on GET requests. ON CopyDocumentSet
body: <p>I have tried everything with this issue, but cant find the error.</p>
  
  <p>THe structure of my site is like this</p>
  
  <p>Meetings (SiteCollection, RootWeb)</p>
  
  <p>1.1 BoardOFDirectors (subsite)</p>
  
  <p>1.1.1 20120101 (subsite)</p>
  
  <p>1.1.2 20120202 (subsite)</p>
  
  <p>Inside meetings there is a list called meetings. Inside each subsite there is a list called agenda points with document sets.</p>
  
  <p>I created a custom action to copy agenda points from one meeting site to the next one.</p>
  
  <p>I am getting the following exception in the CopyTo method. As you can see there I set the allowunsafeupdates=true everywhere. What am I missing??</p>
  
  <p>Updates are currently disallowed on GET requests. To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb.</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
          {
              Logger.LogDebug("CopyAgendaPointToNextMeetingWithAttachments", "Page_Load(object sender, EventArgs e)", "BEGIN");
  
              string source = Request.Url.ToString();
              string state = Request.GetQueryStringValue(MeetingsCommon.Constants.QUERYSTRINGPARAMETER_STATE_NAME);
              string statusMessage = Request.GetQueryStringValue(MeetingsCommon.Constants.QUERYSTRINGPARAMETER_MESSAGE_NAME);
              this.litMessage.Text = statusMessage;
  
              if (!string.IsNullOrEmpty(state))
                  return;
  
              using (SPLongOperation operation = new SPLongOperation(this.Page))
              {
                  SPWeb currentWeb = SPContext.Current.Web;
                  SPSite currentSite = currentWeb.Site;
                  try
                  {                    
                      operation.Begin();
                      currentSite.WebApplication.FormDigestSettings.Enabled = false;
                      currentSite.RootWeb.AllowUnsafeUpdates = true;
                      currentWeb.AllowUnsafeUpdates = true;  
  
                      string listID = Request.QueryString[MeetingsCommon.Constants.QUERYSTRINGPARAMETER_LISTID_NAME];
                      string listItemID = Request.QueryString[MeetingsCommon.Constants.QUERYSTRINGPARAMETER_ID_NAME];  
                      string webappUrl = currentSite.WebApplication.GetResponseUri(currentSite.Zone).ToString();
                      source = source.Replace(webappUrl.ToLower(), currentWeb.Url.ToLower() + "/");
  
                      SPSecurity.RunWithElevatedPrivileges(() =&gt;
                      {
                          SPList currentList = currentWeb.GetSafeListByGuid(new Guid(listID));
                          SPListItem item = currentList.GetItemById(Convert.ToInt32(listItemID));
                          SPWeb siteCollectionRootWeb = currentWeb.ParentWeb.ParentWeb.Site.RootWeb;
                          string type = currentWeb.Name.Substring(0, 2);
                          SPList listMeetingsRoot = siteCollectionRootWeb.GetSafeListByName(Meetings.Common.Constants.LISTS_MEETINGCALENDAR_NAME);
  
  
                          SPQuery query = new SPQuery();
                          query.Query = string.Concat(
                              "&lt;Where&gt;",
                              "&lt;And&gt;",
                              "&lt;BeginsWith&gt;",
                                  "&lt;FieldRef Name='" + Meetings.Common.Constants.FIELDS_TEXT_TITLE_NAME + "' /&gt;",
                                  "&lt;Value Type='Text'&gt;" + type + "&lt;/Value&gt;",
                              "&lt;/BeginsWith&gt;",
                              "&lt;Gt&gt;",
                                  " &lt;FieldRef Name='" + Meetings.Common.Constants.FIELDS_EVENTDATE_NAME + "' /&gt;",
                                  "&lt;Value Type='DateTime'&gt;&lt;Today /&gt;&lt;/Value&gt;",
                              "&lt;/Gt&gt;",                                   
                              "&lt;/And&gt;",
                              "&lt;/Where&gt;");
                          query.RowLimit = 1;
  
                          SPListItemCollection itemsMeetings = listMeetingsRoot.GetItems(query);
                          if (itemsMeetings.Count == 1)
                          {
                              SPFieldUrlValue value = new SPFieldUrlValue(itemsMeetings[0][Meetings.Common.Constants.FIELDS_MEETINGSITEURL_NAME].ToString());
                              string urlOfNextMeetingSite = value.Url;
                              using (SPSite nextMeetingSite = new SPSite(urlOfNextMeetingSite))
                              {
                                  using (SPWeb nextMeetingWeb = nextMeetingSite.OpenWeb())
                                  {
                                      try
                                      {
                                          nextMeetingSite.RootWeb.AllowUnsafeUpdates = true;
                                          nextMeetingWeb.ParentWeb.AllowUnsafeUpdates = true;
                                          nextMeetingWeb.AllowUnsafeUpdates = true;
                                          SPList targetList = nextMeetingWeb.GetSafeListByName(MeetingsCommon.Constants.LISTS_AGENDAPOINTS_NAME);
                                          SPDocumentLibrary targetDocumentLibrary = nextMeetingWeb.GetSafeDocumentLibraryByName(MeetingsCommon.Constants.LISTS_AGENDAPOINTS_NAME);
                                          SPContentTypeId targetCTId = targetList.ContentTypes.BestMatch(new SPContentTypeId(MeetingsCommon.Constants.CONTENTTYPES_AGENDAPOINT_ID));
                                          string id = itemsMeetings[0]["UniqueId"].ToString();
  
                                          DocumentSet sourceDocumentSet = DocumentSet.GetDocumentSet(item.Folder);
                                          DocumentSet targetDocumentSet = null;
                                          if (sourceDocumentSet != null)
                                          {
                                              targetDocumentSet = sourceDocumentSet.CopyTo(targetList.RootFolder, targetCTId);
                                              SPListItem destinationListItem = targetDocumentSet.Item;
                                              destinationListItem[MeetingsCommon.Constants.FIELDS_AGENDAPOINTSRECURRENT_NAME] = "False";
                                              destinationListItem[MeetingsCommon.Constants.FIELDS_AGENDAPOINTSCOPYATTACHMENTS_NAME] = "False";
                                              destinationListItem.Update();
                                              statusMessage = string.Format(HelperFunctions.GetResourceString(MeetingsCommon.Constants.RESOURCES_FILE_NAME, "Message_CopyAgendaPoint"), nextMeetingWeb.Url, nextMeetingWeb.Name);
                                          }
                                      }
                                      catch (Exception)
                                      {
                                          throw;
                                      }
                                      finally
                                      {
                                          nextMeetingWeb.AllowUnsafeUpdates = false;
                                          nextMeetingWeb.ParentWeb.AllowUnsafeUpdates = false;
                                          nextMeetingSite.RootWeb.AllowUnsafeUpdates = false;
                                      }                                    
                                  }
                              }
                          }
                          else
                          {
                              statusMessage = HelperFunctions.GetResourceString(MeetingsCommon.Constants.RESOURCES_FILE_NAME, "Message_CopyAgendaPointNoNextSiteFound");
                          }
                      });
                  }
                  catch (Exception ex)
                  {
                      Logger.LogError("CopyAgendaPointToNextMeetingWithAttachments", "Page_Load(object sender, EventArgs e)", ex);
                      statusMessage = ex.Message;
                  }
                  finally
                  {
                      statusMessage = HttpUtility.UrlEncode(statusMessage);                                    
                      currentWeb.AllowUnsafeUpdates = false;
                      currentSite.RootWeb.AllowUnsafeUpdates = false;
                      currentSite.WebApplication.FormDigestSettings.Enabled = true;   
                      operation.End(source, Microsoft.SharePoint.Utilities.SPRedirectFlags.DoNotEncodeUrl, HttpContext.Current, "&amp;state=completed&amp;message=" + statusMessage);
                  }
                  Logger.LogDebug("CopyAgendaPointToNextMeetingWithAttachments", "Page_Load(object sender, EventArgs e)", "END");
              }
          }
  </code></pre>