Operation is not valid due to the current state of the object

Operation is not valid due to the current state of the object This is one of the common errors that you see during SharePoint development. There could be many reasons for this error to occur. Here I will discuss one scenario. I have noticed that sometimes calling SPContext throws this error. It seems to be a bug. The code works for the first time but throws an error if you run the same statement again (during the same session). For example, consider the following code: SPSecurity .RunWithElevatedPrivileges...(read more) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Read the complete post at http://www.sharepointblogs.com/ssa/archive/2007/11/25/operation-is-not-valid-due-to-the-current-state-of-the-object.aspx

Published Sunday, November 25, 2007 11:30 PM by SharePoint Blogs