protected void DuplicateApp_Click(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        try
        {
            ClearMessages();
            if (SavedCanvasHtml.Text.Length > 0)
                SavePage();
            State["SelectedApp"] = CurrentApp.SelectedValue;
            AppName.Text = Request.Form.Get("AppName");
            string new_name = AppName.Text.Trim();
            AppName.Text = "";
            util.CopyApp(State, new_name);
            Message.Text = new_name + " has been created. ";
            Init init = new Init();
             State["SelectedApp"] = new_name;
            UpdateAppLists();
            InitAppPages();
        }
        catch (Exception ex)
        {
             util.LogError(State, ex);
            Message.Text = "Internal Error: " + ex.Message + ": " + ex.StackTrace;
        }
    }