Trying to use an SPWeb object that has been closed or disposed and is no longer valid.

when you use:

using(SPWeb oWeb= SPContext.Current.Web)
{
.....
}

this cause the error: Trying to use an SPWeb object that has been closed or disposed and is no longer valid.

the solution:

try
{
   SPSite oSite=SPContext.Current.Site;
   using(SPWeb oWeb=oSite.openWeb())
  {
    .....
  }
}

Comments

Popular posts from this blog

add header image itextsharp c#

Basketball in Peru