protected void Submit_Click(object sender, EventArgs e)
        {
            if (ctlMySignature.IsValid())
            {
                // show the newly generated signature image in sign area (optional)
                ctlMySignature.ShowSignature();

                // get the path of generated signature file
                string finalImg = ctlMySignature.SignatureFile;
                Session.Add("Signature", finalImg);
                if (Session["ClientID"] != null && Session["UserID"] != null)
                {
                    ByteBuffer PDF = (ByteBuffer)Session["PDF"];
                    SignAndDatePDF myPDF = new SignAndDatePDF(PDF);
                    myPDF.SignPDF(Server.MapPath(finalImg));
                    myPDF.close();
                    ByteBuffer pdf = myPDF.getSignedPDF();
                    Session.Add("Signed", pdf);

                    try
                    {
                        Encrypt encPDF = new Encrypt((Guid)Session["UserID"], Request.UserHostAddress.ToString());
                        encPDF.EncryptPDF(pdf.Buffer);
                        Response.Redirect("thankyou.aspx", false);
                    }
                    catch (Exception ex)
                    {

                    }

                }
                else
                {
                    Response.Redirect("Default.aspx?timeout=1");
                }
            }
            else
            {
                Page.RegisterStartupScript("nosign", "<script language='javascript'>ClearSignature();</script>");
                Page.RegisterStartupScript("nosign", "<script language='javascript'>alert('" + ctlMySignature.NoSignMessage + "');</script>");
            }
        }
        protected void UserWizard1_FinishButtonClick(object sender, EventArgs e)
        {
            //Process The Application and save it.
            #region Sign Application
            if (UserWizard1.ActiveStepIndex == 14)
            {
                if (ctlMySignature.IsValid())
                {
                    // show the newly generated signature image in sign area (optional)
                    ctlMySignature.ShowSignature();

                    // get the path of generated signature file
                    string finalImg = ctlMySignature.SignatureFile;
                    Session.Add("Signature", finalImg);
                    if (Session["ClientID"] != null && Session["UserID"] != null)
                    {
                        ByteBuffer PDF = (ByteBuffer)Session["PDF"];
                        SignAndDatePDF myPDF = new SignAndDatePDF(PDF);
                        myPDF.SignPDF(Server.MapPath(finalImg));
                        myPDF.close();
                        ByteBuffer pdf = myPDF.getSignedPDF();
                        Session.Add("Signed", pdf);

                        try
                        {
                            Encrypt encPDF = new Encrypt((Guid)Session["UserID"], Request.UserHostAddress.ToString());
                            encPDF.EncryptPDF(pdf.Buffer);
                        }
                        catch (Exception ex)
                        {
                            Title = "!!! " + Title;
                        }

                    }
                    else
                    {
                        Response.Redirect("~/Default.aspx?timeout=1");
                    }
                }
                else
                {
                    Page.RegisterStartupScript("nosign", "<script language='javascript'>ClearSignature();</script>");
                    Page.RegisterStartupScript("nosign", "<script language='javascript'>alert('" + ctlMySignature.NoSignMessage + "');</script>");
                }
            }
            #endregion
        }