Posts

Showing posts from March, 2013

Solved! The state information is invalid for this page and might be corrupted. Solved!

Image
Hello Mates, While working on a ASP.NET project in framework 4.0 i faced a strange error. It was working fine on development machine but failed on server. I google around and spent my 6 to 7 hours to fix the issue. I have tried with making changes in Web.Config and in the page directives but in vain. Finally i decided to troubleshoot my code line by line and point out the issue. The Error was... The state information is invalid for this page and might be corrupted.  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.  Exception Details: System.Web.HttpException: The state information is invalid for this page and might be corrupted. Source Error:  The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL: 1. Add a &quo

Iterating through all Web Applications,Site Collections,Sites,Lists and Libraries and Items in a SharePoint farm

private void TraversFarm()         {             SPFarm farm = SPFarm .Local;             foreach ( SPService curService in farm.Services)             {                 if (curService is SPWebService )                 {                     SPWebService webService = ( SPWebService )curService;                     foreach ( SPWebApplication webApp in webService.WebApplications)                     {                         foreach ( SPSite site in webApp.Sites)                         {                              using ( SPWeb web = site.OpenWeb())                             {                                 foreach ( SPList list in web.Lists)                                 {                                     foreach ( SPListItem item in list.Items)                                     {                                         //DO Something here                                     }                                 }