Actually I have to implement some kind of an WYSIWYG Editor for SharePoint Pages (SharePoint Publishing Feature). The versioning and “need to checkout file for edit” option are activated. During my test’s I ran into the issue that everytime I changed something on a page and clicked on “Save & Close”, this dialog came up:

First I thougt that is has to do with impersonation, and tried this:
var userToken = SPContext.Current.Site.UserToken;
using (SPSite site = new SPSite(SPContext.Current.Site.Url, userToken))
{
using (SPWeb authWeb = site.OpenWeb())
{
var pageItem = authWeb.Lists["Pages"].GetItemById(1);
pageItem["MemoryTest"] = TestBox.Text;
pageItem.SystemUpdate(false);
}
}
Unfortunately this doesnt change anything, I was still getting the dialog. After this I tried to use SPListItem.SystemUpdate instead of SPListItem.Update:
var page = SPContext.Current.Web.Lists["Pages"].GetItemById(1);
page["MemoryTest"] = TestBox.Text;
page.SystemUpdate();
This was also a failure. The dialog still comes up. I tried many other things, elevated privileges, different way’s of getting the page object (via SPContext, via ID, via OpenWeb) but nothing worked. After hours I found a way. To use SPListItem.SystemUpdate(false) did the trick! If you use SystemUpdate(false) you dont increment the version with your update. This leads to the behaviour that SharePoint don’t recognize that you’ve changed something.
var page = SPContext.Current.Web.Lists["Pages"].GetItemById(1);
page["MemoryTest"] = TestBox.Text;
//false did the trick!
page.SystemUpdate(false);
On the first view this looks a bit dirty, because you change something without affecting the “ModifiedBy” and “LastModified” fields. But in my case the “field to change” is a hidden-field which is never gonna seen by someone. And with the checkout-required flag every version of the page is restorable.
Edit:
After a week of testing I found out that I made a general mistake, which leads to the Save-Conflict Dialog:
I instantiated a new instance of the current page object, saved the changed data to it and called the .Update method. This leads to a save conflict because another instance of the page is already instantiated from sharepoint. The solution was quite simple: Use it
To save my data I just have to call this:
SPContext.Current.ListItem["MemoryTest"] = TestBox.Text;
It’s very important that you DONT call update afterwards. This does SharePoint for you when the user hits “Checkin” “Save” and so on.