If you are trying to do impersonation using SPSecurity.RunWithElevatedPrivileges remember, SPContext.Current will not work for you. The proper method of using SPSecurity.RunWithElevatedPrivileges in your code for impersonation is:
Be sure to create a new SPSite which is the root security reference while you’re impersonating. Here’s a small code snippet:
SPWeb web = SPContext.Current.Web;
SPUser user = web.CurrentUser; // the calling user
// Uses the SHAREPOINT\system creds with the SPUser's identity reference of user
SPSecurity.RunWithElevatedPrivileges(delegate() {
// Gets a new security context using SHAREPOINT\system
using (SPSite site = new SPSite(this.Page.Request.Url.ToString())) {
using (SPWeb thisWeb = site.OpenWeb()) {
thisWeb.AllowUnsafeUpdates = true;
SPList theList = thisWeb.Lists[listName];
SPListItem record = theList.Items.Add();
record["User"] = user; // calling user
record.Update(); // uses SHAREPOINT\system
}
}
});