Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Monday, 2 June 2014

ErrorLog For Project

            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);
Please provide your feedback in the comments section above. Please don't forget to follow.