private void DownloadRolesExport()
        {
            var allright = CurrentRights.GetAllRightsMaster();
            var rols     = Request.Form.Get("rol");

            if (rols != null)
            {
                foreach (var rol in rols.Split(','))
                {
                    var account = Sitecore.Security.Accounts.Role.FromName(rol);
                    if (account == null)
                    {
                        break;
                    }
                    dowload.Text += "role," + account.Name + ",";
                    int count = 0;
                    foreach (var subrol in RolesInRolesManager.GetRolesInRole(account, false))
                    {
                        if (count != 0)
                        {
                            dowload.Text += "|";
                        }
                        dowload.Text += subrol.Name;
                        count++;
                    }
                    dowload.Text += "\n";
                }
                foreach (var rol in rols.Split(','))
                {
                    var account = Sitecore.Security.Accounts.Role.FromName(rol);
                    if (account == null)
                    {
                        break;
                    }
                    foreach (var itemWithRights in allright)
                    {
                        var accessRules = itemWithRights.Security.GetAccessRules();
                        if (accessRules != null)
                        {
                            foreach (var rule in accessRules)
                            {
                                if (rule.Account == account)
                                {
                                    AccessRuleCollection ruleCollection = new AccessRuleCollection();
                                    ruleCollection.Add(rule);
                                    dowload.Text += itemWithRights.Paths.FullPath + "," + ruleCollection.ToString() + "\n";
                                }
                            }
                        }
                    }
                }
            }
            Response.Clear();
            Response.ContentType = "application/CSV";
            Response.AddHeader("Cache-Control", "must-revalidate");
            Response.AddHeader("Pragma", "must-revalidate");
            Response.AddHeader("Content-type", "application/x-download");
            Response.AddHeader("Content-disposition", "attachment; filename=sitecore-roles-export.csv");
        }
        private static void Step2(HttpRequest request, Literal rolesexport)
        {
            rolesexport.Text += "Export preview<br><br>";
            var allright = CurrentRights.GetAllRightsMaster();
            var rols     = request.Form.Get("rol");

            if (rols != null)
            {
                foreach (var rol in rols.Split(','))
                {
                    rolesexport.Text += "<strong>" + rol + "</strong>  :<br> ";
                    var account = Sitecore.Security.Accounts.Role.FromName(rol);
                    if (account == null)
                    {
                        break;
                    }
                    foreach (var itemWithRights in allright)
                    {
                        var accessRules = itemWithRights.Security.GetAccessRules();
                        if (accessRules != null)
                        {
                            foreach (var rule in accessRules)
                            {
                                if (rule.Account == account)
                                {
                                    AccessRuleCollection ruleCollection = new AccessRuleCollection();
                                    ruleCollection.Add(rule);
                                    rolesexport.Text += itemWithRights.Paths.FullPath + " " + RightsHelper.RightToHtml(rule) + " " + rule.AccessRight.Name + " " + rule.SecurityPermission.ToString() + "<br>";
                                }
                            }
                        }
                    }
                    rolesexport.Text += "<br>\n";
                }
                rolesexport.Text += "<form method=\"post\" action=\"/sitecore modules/Shell/Security-Rights-Reporting/Download.aspx?rolesexport=1\" enctype=\"multipart/form-data\"><input type=\"hidden\" id=\"rol\" name=\"rol\" value=\"" + "" + HttpUtility.HtmlAttributeEncode(rols) + "\"><input type=\"submit\" value=\"Download\" name=\"submit\" ></form>";
            }
        }