More in this section

Forums / Developing with Sitefinity / Track who deleted a page?

Track who deleted a page?

2 posts, 0 answered
  1. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    04 May 2005
    25 Sep 2009
    Link to this post
    Hi everyone, 

    How can we track who deleted pages? Since deletions are permanent, is all page info wiped from the DB?

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    25 Sep 2009
    Link to this post

    Here are the steps that you should follow

    1. Create a new database table.
    2. You should subscribe for ContentManager.Executed event in Application_Start method of project's Global.asax file.

     Telerik.Cms.Engine.ContentManager.Executed += new EventHandler<Telerik.ExecutedEventArgs>(ContentManager_Executed); 

    3. Then add some logic to your event.

    void CmsManager_Executed(object sender, Telerik.ExecutedEventArgs e) 
            switch (e.CommandName) 
                case "CreatePage"
                case "Publish"
                case "PublishNew"
                case "DeletePage"
                   string username = Telerik.Security.UserManager.GetCurrentUserName(); 
                   string query = "INSERT INTO DeletedPage ([username],[pageID]) VALUES ('" + username + "', '" + e.ItemID.ToString() + "')"
                   System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["Sitefinity"].ConnectionString); 
                   System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(query, connection); 

    I hope this helps.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered