public static string IdToFile(string id, HttpContext context)
        {
            string sRoot   = getRootFolder(context);
            string sFolder = EnCryptString.DeCrypt(id);

            if (!sRoot.EndsWith(@"\"))
            {
                sRoot += @"\";
            }

            if (sFolder != null && sFolder.Length > 0)
            {
                if (sFolder.StartsWith("Root"))
                {
                    sFolder = (sRoot + sFolder.Substring(5, sFolder.Length - 5)).Replace('/', '\\');
                }
            }
            return(sFolder);
        }
        private void getlist(HttpContext context)
        {
            var serializer = new JavaScriptSerializer();

            context.Response.ContentType     = "application/json";
            context.Response.ContentEncoding = Encoding.UTF8;
            string sContent = "";

            string sRoot   = getRootFolder(context);
            string sFolder = sRoot;

            if (!sFolder.EndsWith(@"\"))
            {
                sFolder += @"\";
            }
            if (context.Request.QueryString["fd"] != null && context.Request.QueryString["fd"].Length > 0)
            {
                string s = context.Request.QueryString["fd"];
                if (s.StartsWith("Root"))
                {
                    sFolder = sRoot + s.Substring(4, s.Length - 4).Replace('/', '\\');
                }
            }
            if (!Directory.Exists(sFolder))
            {
                context.Response.Write("{error:'folder not exist'}");
                return;
            }

            List <FileInfo> oList       = new List <FileInfo>();
            var             directories = Directory.GetDirectories(sFolder);

            foreach (var directory in directories)//load all folder
            {
                var      di    = new DirectoryInfo(directory);
                string   sPath = di.FullName.Replace(sRoot, "Root").Replace('\\', '/');
                FileInfo info  = new FileInfo
                {
                    id         = EnCryptString.EnCrypt(sPath),
                    error      = "",
                    path       = sPath,
                    name       = di.Name,
                    isFile     = false,
                    type       = "folder",
                    length     = "",
                    DateCreate = di.CreationTime,
                    DateEdit   = di.LastWriteTime,
                    isHidden   = di.Attributes == FileAttributes.Hidden,
                    isReadOnly = di.Attributes == FileAttributes.ReadOnly,
                    isSystem   = di.Attributes == FileAttributes.System,
                    url        = ""
                };
                oList.Add(info);
            }

            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(sFolder);
            foreach (System.IO.FileInfo f in dir.GetFiles("*.*"))//load all file
            {
                string   sPath = f.FullName.Replace(sRoot, "Root").Replace('\\', '/');
                FileInfo info  = new FileInfo
                {
                    id         = EnCryptString.EnCrypt(sPath),
                    error      = "",
                    path       = sPath,
                    name       = f.Name,
                    isFile     = true,
                    type       = Path.GetExtension(f.FullName).Replace(".", string.Empty),
                    length     = UntilityFunction.ShowCappacityFile(f.Length),
                    DateCreate = f.CreationTime,
                    DateEdit   = f.LastWriteTime,
                    isHidden   = f.Attributes == FileAttributes.Hidden,
                    isReadOnly = f.Attributes == FileAttributes.ReadOnly,
                    isSystem   = f.Attributes == FileAttributes.System
                };
                oList.Add(info);
            }

            sContent = Newtonsoft.Json.JsonConvert.SerializeObject(oList, new JavaScriptDateTimeConverter());
            context.Response.Write(context.Request["jsoncallback"] + "(" + sContent + ")");
        }