public void ProcessRequest(HttpContext context)
        {
            string imgID = context.Request.QueryString["id"];

            SCSMOC.SmartObjectClientServer smoSvr = new SCSMOC.SmartObjectClientServer();
            try
            {
                smoSvr.CreateConnection();
                smoSvr.Connection.Open(GetSMOConnStr());

                SCSMOC.SmartObject smoObj = smoSvr.GetSmartObject("DigitalSignature");
                smoObj.Properties["ID"].Value = imgID;

                smoObj.MethodToExecute = "Load";
                smoObj = smoSvr.ExecuteScalar(smoObj);

                context.Response.Write(smoObj.Properties["Signature"].Value);
            }
            finally
            {
                if (smoSvr.Connection != null && smoSvr.Connection.IsConnected)
                {
                    smoSvr.Connection.Dispose();
                }
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            #region Get image in PNG format
            //take JSON string and convert to png
            string jsonStr = context.Request.Form["json"];

            SignatureToImage sit = new SignatureToImage();

            #region set the width and height (IMPORTANT!!)
            try
            {
                sit.CanvasWidth = Convert.ToInt32(context.Request.Form["width"]);
            }
            catch
            {
                sit.CanvasWidth = 200;
            }
            try
            {
                sit.CanvasHeight = Convert.ToInt32(context.Request.Form["height"]);
            }
            catch
            {
                sit.CanvasHeight = 60;
            }
            #endregion

            Bitmap bitmapImg = sit.SigJsonToImage(jsonStr);

            string pngStr = string.Empty;
            using (MemoryStream ms = new MemoryStream())
            {
                bitmapImg.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                byte[] pngBin = new byte[ms.Length];
                pngBin = ms.ToArray();
                pngStr = "data:image/png;base64," + Convert.ToBase64String(pngBin);
            }
            #endregion

            #region save to smartobject and return the new obj ID
            SCSMOC.SmartObjectClientServer smoSvr = new SCSMOC.SmartObjectClientServer();
            try
            {
                smoSvr.CreateConnection();
                smoSvr.Connection.Open(GetSMOConnStr());

                SCSMOC.SmartObject smoObj = smoSvr.GetSmartObject("DigitalSignature");
                smoObj.Properties["Signature"].Value = pngStr;
                smoObj.Properties["FormURL"].Value   = context.Request.Form["url"];
                smoObj.Properties["UserFQN"].Value   = context.Request.Form["fqn"];
                smoObj.Properties["Date"].Value      = DateTime.Now.ToString();

                smoObj.MethodToExecute = "Create";
                smoObj = smoSvr.ExecuteScalar(smoObj);

                context.Response.Write(smoObj.Properties["ID"].Value.ToString());
            }
            finally
            {
                if (smoSvr.Connection != null && smoSvr.Connection.IsConnected)
                {
                    smoSvr.Connection.Dispose();
                }
            }
            #endregion
        }