SPWeb oWeb = SPContext.Current.Web;
SPList olist = oWeb.Lists["listname"];
oWeb.AllowUnsafeUpdates = true;
SPListItem itemToAdd = olist.Items.Add();
itemToAdd["HelpLink"] = ex.HelpLink;
itemToAdd["Message"] = ex.Message;
itemToAdd["Source"] = ex.Source;
itemToAdd["StackTrace"] = ex.StackTrace;
itemToAdd["TargetSite"] = ex.TargetSite;
SPUser oUser = oWeb.EnsureUser(oWeb.CurrentUser.LoginName);
itemToAdd["UserName"] = oUser;
itemToAdd["Module"] = ex.TargetSite.DeclaringType;
itemToAdd.Update();
oWeb.AllowUnsafeUpdates = false;
Response.Redirect("/SitePages/Error.aspx", false);
SPList olist = oWeb.Lists["listname"];
oWeb.AllowUnsafeUpdates = true;
SPListItem itemToAdd = olist.Items.Add();
itemToAdd["HelpLink"] = ex.HelpLink;
itemToAdd["Message"] = ex.Message;
itemToAdd["Source"] = ex.Source;
itemToAdd["StackTrace"] = ex.StackTrace;
itemToAdd["TargetSite"] = ex.TargetSite;
SPUser oUser = oWeb.EnsureUser(oWeb.CurrentUser.LoginName);
itemToAdd["UserName"] = oUser;
itemToAdd["Module"] = ex.TargetSite.DeclaringType;
itemToAdd.Update();
oWeb.AllowUnsafeUpdates = false;
Response.Redirect("/SitePages/Error.aspx", false);
No comments:
Post a Comment