private void ProcessGetImage(HttpContext context)
        {
            string contentID = context.Request.QueryString["imagePropID"];
            string filePath  = context.Request.QueryString["filePath"];

            if (string.IsNullOrEmpty(contentID) == false)
            {
                if (string.IsNullOrEmpty(filePath) == false)
                {
                    filePath = MachineKeyEncryptor.Decrypt(filePath);
                    string filename = Path.GetFileName(filePath);

                    if (File.Exists(filePath))
                    {
                        context.Response.ContentType = "image/jpeg";
                        context.Response.AddFileDependency(filePath);
                        context.Response.Cache.SetLastModifiedFromFileDependencies();
                        context.Response.Cache.VaryByParams["contentID"] = true;
                        context.Response.Cache.VaryByParams["filePath"]  = true;
                        context.Response.Cache.SetETagFromFileDependencies();
                        var    cacheCtrl       = context.Request.Headers["Cache-Control"];
                        var    ifModifiedSince = context.Request.Headers["If-Modified-Since"];
                        string lastChangeSince;

                        try
                        {
                            lastChangeSince = context.Response.Headers["Last-Modified"];
                        }
                        catch (Exception)
                        {
                            lastChangeSince = null;
                        }

                        if (string.IsNullOrEmpty(ifModifiedSince) == false && ifModifiedSince == lastChangeSince)
                        {
                            context.Response.StatusCode = 302;
                        }
                        else
                        {
                            context.Response.WriteFile(filePath, false);
                        }
                    }
                    else
                    {
                        ProcessGetImageById(contentID, context);
                    }
                }
                else
                {
                    ProcessGetImageById(contentID, context);
                }
            }
            else
            {
                BadRequest(context.Response, "没有指定imagePropID参数");
            }
        }
        private void ProcessFileUpload(HttpContext context)
        {
            HttpPostedFile file = context.Request.Files[0];

            if (file.ContentType == "image/jpeg")
            {
                string maxSizeString = context.Request.QueryString["maxSize"];
                int    maxSize       = string.IsNullOrEmpty(maxSizeString) ? -1 : int.Parse(maxSizeString);
                string imgInfoStr    = context.Request.Form["imageInfo"];
                if (string.IsNullOrEmpty(imgInfoStr) == false)
                {
                    var imgProp = JSONSerializerExecute.Deserialize <ImageProperty>(imgInfoStr);

                    if (string.IsNullOrWhiteSpace(imgProp.ID))
                    {
                        imgProp.ID = Guid.NewGuid().ToString();
                    }

                    imgProp.NewName    = UuidHelper.NewUuidString() + Path.GetExtension(imgProp.OriginalName);
                    imgProp.Changed    = true;
                    imgProp.UpdateTime = SNTPClient.AdjustedTime;

                    if (maxSize < 0 || file.ContentLength <= maxSize)
                    {
                        string filePath;
                        // ImageUploadHelper.UploadFile(file, imgProp.OriginalName, imgProp.NewName, out filePath);


                        string path     = GetUploadRootPath("ImageUploadRootPath");
                        string tempPath = Path.Combine(path + @"Temp\", imgProp.NewName);
                        AutoCreateUploadPath(path);

                        // var beforeArgs = new UploadEventArgs(originalName);
                        // uploadControl.OnBeforeUploadFile(beforeArgs);
                        file.SaveAs(Path.Combine(path + @"Temp\", imgProp.NewName));
                        //var afterArgs = new UploadEventArgs(newName);
                        //uploadControl.OnAfterUploadFile(afterArgs);

                        filePath = tempPath;

                        imgProp.FilePath = MachineKeyEncryptor.Encrypt(filePath);

                        string imgPropJsonStr = JSONSerializerExecute.Serialize(imgProp);

                        string uploadImageShowenUrl = "some.imgupload?action=getimage&imagePropID=" + imgProp.ID + "&filePath=" + MachineKeyEncryptor.Encrypt(filePath);

                        context.Response.ContentType = "text/html";
                        var output = context.Response.Output;

                        System.Web.UI.HtmlTextWriter writer = new System.Web.UI.HtmlTextWriter(output);
                        BeginForm(writer);

                        AddInput(writer, "imgInfo", imgPropJsonStr);
                        AddInput(writer, "imgPath", uploadImageShowenUrl);

                        EndForm(writer);

                        output.Close();


                        //context.Response.Write(GetResponseTextScript(imgPropJsonStr));

                        //context.Response.Write(GetUploadImageUrlByFile(uploadImageShowenUrl));

                        //string paramsData = string.Format("['{0}','{1}']", "document.getElementById('responseInfo').value", uploadImageShowenUrl);

                        //context.Response.Write(GetClientControlInvokeStript(GetPostedControlID(), "uploadSuccess", "document.getElementById('responseInfo').value", "document.getElementById('uploadImageUrlByFile').value"));
                    }
                    else
                    {
                        BadRequest(context.Response, "上传文件太大");
                    }
                }
            }
        }