What can cause “Error page has been modified”

English (versi bahasa Indonesia)

For anyone who customize SharePoint using SharePoint Designer, I believe you’ve familiar with “Error page has been modified”. The reason is obvious, you open the page in browser while modifying it using SharePoint Designer. Then save the page withing SharePoint Designer and try to access any links in that page. So, just go back , refresh and the link will works again.

PageRefreshIssue

But how about in a case that this happened in production environment, where nobody edit the page behind the screen. What can cause “Error page has been modified” ?

I have tried some resources from internet and check whether this can help me solve the problem:

1. One or more feature is missing (http://forums.technet.microsoft.com/en-US/sharepointgeneral/thread/9a98188b-9dec-4d85-b8b7-47ba41e5271f/)
2. Use of PublishingLayoutsPage instead of TemplateRedirectionPage (http://blogs.msdn.com/tejasr/archive/2008/06/19/resolution-moss-this-page-has-been-modified-since-you-opened-it-you-must-open-the-page-again.aspx)
3. Use of NLB with affinity set to none (http://support.microsoft.com/kb/892348)
4. Some says that security enhancement in MOSS SP1 (KB936984) /WSS SP1 (KB936988)help to fix this problem.

But unfortunatelly I come back with no luck, untill I read an article “The evil’s of RunWithElevatedPrivilege from Danniel Larson”. I believe that since it drops down to the thread identity, then the current session in page is no longer valid with the links. Thus creating exception “Error page has been modified”.  Then, I instructed my team to change all impersonation method to use

SPUserToken sysToken = SPContext.Current.Site.SystemAccount.UserToken;
using(var systemSite = new SPSite(SPContext.Current.Site.ID, sysToken))
{
    using (var sysWeb = systemSite.OpenWeb(SPContext.Current.Web.ID))
    {
        // Perform elevated actions here
    }
}

instead of using old

SPSecurity.RunWithElevatedPrivilege(delegate()
{
     using(var systemSite = new SPSite(SPContext.Current.Web.Url))
     {
           using (var sysWeb = systemSite.OpenWeb(SPContext.Current.Web.ID))
          {
               // Perform elevated actions here
          }

      }
});

 

That is and the production issues gone. So from now I would add one more entry to the list, Minimalize using RunWithElevatedPrivilege in your code, and use SPUserToken instead.

-o0o-

 

Indonesia (see English version)

Bagi rekan-rekan yang sering bekerja dengan SharePoint Designer, pesan kesalahan berikut ini pasti sering dijumpai “Error page has been modified”. Penyebabnya jelas sekali, karena kita membuka halaman di browser sementara di balik layar dilakukan editing dengan menggunakan SharePoint Designer. Kemudian setelah melakukan editing dan menyimpan halaman di SharePoint designer, kita langsung mengklik salah satu link di halaman yang telah dibuka. Cara mengatasinya cukup mudah , kembali ke halaman semula , refresh dan link-link akan bisa diakses seperti semula.

PageRefreshIssue

Tetapi bagaimana dengan kejadian yang muncul di server produksi? Di server produksi, tidak seorang pun mengedit halaman dengan SharePoint Designer. Jadi apa yang bisa menyebabkan “Error page has been modified” ?

Seperti biasa, saya mencari-cari informasi di internet dan menemukan beberapa hal dibawah yang mungkin dapat membantu:

1. Ada fitur yang ada di datastore tapi hilang secara fisik (http://forums.technet.microsoft.com/en-US/sharepointgeneral/thread/9a98188b-9dec-4d85-b8b7-47ba41e5271f/)
2. Tidak menggunakan TemplateRedirectionPage tapi PublishingLayoutsPage (http://blogs.msdn.com/tejasr/archive/2008/06/19/resolution-moss-this-page-has-been-modified-since-you-opened-it-you-must-open-the-page-again.aspx)
3. Menggunakan NLB dengan affinity diatur none (http://support.microsoft.com/kb/892348)
4. Beberapa mengatakan bahwa perbaikan prosedur keamanan di MOSS SP1 (KB936984) /WSS SP1 (KB936988) akan membantu menyelesaikan masalah.

Sayangnya semua hal diatas sudah terpenuhi, tetapi tetap saja masalah tersebut muncul. Sampai akhirnya saya membaca artikel tentang RunWithElevatedPrivilege – “The evil’s of RunWithElevatedPrivilege dari Danniel Larson”. Dari penjelasan yang ada, saya menduga bahwa penyebabnya adalah karena prosedur tersebut mengganti identitas thread dan menjalankan di thread lain, sehingga halaman yang sedang dibuka akan kehilangan “hubungan” dengan server (mirip dengan pada saat kita menyimpan dengan menggunakan SharePoint Designer). Akibatnya, link-link yang ada di halaman sudah tidak valid lagi dan muncul “Error page has been modified”. 
Berbekal dari dugaan itu, saya kemudian meminta rekan-rekan di team untuk mengganti cara impersonation untuk mengugnakan SPUserToken 

SPUserToken sysToken = SPContext.Current.Site.SystemAccount.UserToken;
using(var systemSite = new SPSite(SPContext.Current.Site.ID, sysToken))
{
    using (var sysWeb = systemSite.OpenWeb(SPContext.Current.Web.ID))
    {
        // Perform elevated actions here
    }
}

dan menghapus RunWithElevatedPrivilege

SPSecurity.RunWithElevatedPrivilege(delegate()
{
     using(var systemSite = new SPSite(SPContext.Current.Web.Url))
     {
           using (var sysWeb = systemSite.OpenWeb(SPContext.Current.Web.ID))
          {
               // Perform elevated actions here
          }

      }
});

 

Dan seperti yang diharapkan, masalah di production akhirnya teratasi. Jadi mulai dari saat ini saya akan menambahkan satu lagi di dalam daftar , Kurangi penggunaan RunWithElevatedPrivilege dan sedapat mungkin gunakan SPUserToken.  

About

Riwut Libinuko, experienced Architect. Currently working with Credit Agricole CIB, responsible for SharePoint platform in Asia Pasific. . Certification: SharePoint 2013, SharePoint 2010, SharePoint 2007, ITiL v3

Posted in Microsoft Sharepoint, Office 12, Office Server 2007, Tips and Tricks

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: