For the following code i was getting following error at the closing bracket of "ImageButton1_Click" methode below is code.
Error :Trying to use an SPWeb object that has been closed or disposed and is no longer valid.
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
using (SPSite site =SPContext.Current.Site )
using (SPWeb web = site.OpenWeb())
// get wikipagelibrary and file
int count = 0;
SPList WikiList = web.Lists["WikiPageLibrary"];
count = int.Parse(WikiList.Items["LikeCount"].ToString()) + 1;
SPListItem item = WikiList.Items;
item["LikeCount"] = count;
web.AllowUnsafeUpdates = false;
Then I changed the code using (SPSite site =SPContext.Current.Site ) to
using (SPSite site =new SPSite (SPContext.Current.Site.Url)) and error gone;