This error happens on every page of the site.

  1. I click on link to open page like http://myportal.com/Lists/List1/
  2. SharePoint open it and in url add smth like AllItems.aspx, so it url looks like http://myportal.com/Lists/List1/AllItems.aspx
  3. After passing some time (3-4 minutes) I refresh this page and this error appears.

This error appears also if I stay for 3-5 minutes on one page and then click on link like http://myportal.com/SitePages/Page1.aspx to go to another.

I have done almost everything that I could find in the net:

  • change the value of MaxHttpCollectionKeys
  • restart services of Timer,Asp.Net state,User Profile,Search
  • start sharepoint configuration wizard.

in monitoring in CA I have error only for indexing schedule manager.

I don't think that it depends on my code, because it happens everywhere on my portal. May be some SPWeb or SPSite object automatically disposing every 3-5 minutes, may be there are some utilities to check this.

Please, help me, I'm trying to decide this problem during 2 weeks, and no results..

Operation is not valid due to the current state of the object. Exception Details: System.InvalidOperationException: Operation is not valid due to the current state of the object.

Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.`

Stack Trace: [InvalidOperationException: Operation is not valid due to the current state of the object.] Microsoft.SharePoint.WebControls.SPControl.EnsureSPWebRequest(SPWeb web) +218 Microsoft.SharePoint.WebControls.SPControl.SPWebEnsureSPControl(HttpContext context) +520 Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.GetContextWeb(HttpContext context) +27 Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PostResolveRequestCacheHandler(Object oSender, EventArgs ea) +918 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171`


UPD: From log:

08/02/2013 09:33:55.35 w3wp.exe (0x1588) 0x1BE0 SharePoint Foundation Logging Correlation Data xmnv Medium Name=Request (GET:http://page.aspx) cccee8b6-0eac-4a4b-ae68-cce0c71a2646

08/02/2013 09:33:55.36 w3wp.exe (0x1588) 0x1BE0 SharePoint Foundation Runtime tkau Unexpected System.InvalidOperationException: Operation is not valid due to the current state of the object. at Microsoft.SharePoint.WebControls.SPControl.EnsureSPWebRequest(SPWeb web) at Microsoft.SharePoint.WebControls.SPControl.SPWebEnsureSPControl(HttpContext context) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.GetContextWeb(HttpContext context) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PostResolveRequestCacheHandler(Object oSender, EventArgs ea) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) cccee8b6-0eac-4a4b-ae68-cce0c71a2646

08/02/2013 09:33:55.38 w3wp.exe (0x1588) 0x1BE0 SharePoint Foundation Monitoring b4ly Medium Leaving Monitored Scope (Request (GET:http://page.aspx)). Время выполнения=26,7436 cccee8b6-0eac-4a4b-ae68-cce0c71a2646

  • Do you use a custom master page?
    – Norbert
    Jul 29, 2013 at 6:34
  • yes, i have custom master page, but i haven't changed it for a long time. I mean I haven't got such error earlier with this custom master page
    – Ksesh
    Jul 29, 2013 at 8:23
  • Can you get SPSite of SPWeb object using powershell without errors? Jul 30, 2013 at 12:10
  • yes, SPSite and SPWeb object works right through powershell. May be it somehow depends on cache configurations? I don't know..
    – Ksesh
    Jul 31, 2013 at 5:56
  • You can perhaps get more information on the underlying cause of the error by looking at the ULS logs. See sharepoint.stackexchange.com/a/52784/14649
    – Nathan
    Aug 1, 2013 at 18:02

1 Answer 1


Has any custom code been deployed across all pages?

Maybe using a delegate control?

It sounds like something on the page has a misconfigured SPControlMode which can be used to change a field to render its Display or Edit Template.


Just looking at the logs. The request coming in which is erroring is for a url pages.aspx. I would expect it to have a full url. I.e. http://sharepoint.local/page.aspx

  • Thanks for you answer. I don't have code, that you've described. Now I'm setting everything to right on my portal. One of possible reason - broken list. I can't delete it because one column was lookup or smth like this, but in the end I removed it, and maybe broke something by this rude action.
    – Ksesh
    Aug 7, 2013 at 3:28
  • I have edited url from logs before posting here. It was in full format like in your example.
    – Ksesh
    Aug 7, 2013 at 18:22
  • Ah ok I see.. darn.
    – Simon Doy
    Aug 8, 2013 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.