使用m2sys finger bioplugin成功验证后重定向页面

时间:2018-06-10 07:22:25

标签: c#

/ *需要在成功进行m2sys手指bioplugin验证后添加我的重定向页面。问题是我发现verify.aspx.cs和ProcessOperation.aspx.cs上的代码不控制页面,因为我停止了在verify.aspx.cs页面上的重定向,但它重定向了,我也删除了响应结果来自ProcessOperation.aspx.cs页面。

验证后我仍然得到了答复。成功验证后,如何在m2sys bioplugin中插入重定向页面代码?请在下面找到代码* /

 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Verification.aspx.cs" Inherits="BioPluginWebApp.Verification" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <object id="BioPlugInActX" style="width:0px; height:0px" classid="CLSID:05E8280C-D45A-494F-AE42-840A40444AFF">
        <param name="_Version" value="65536" />
        <param name="_ExtentX" value="2646" />
        <param name="_ExtentY" value="2646"  />
        <param name="_StockProps" value="0" />
    </object>
    <head runat="server">
    <title>Verification</title>
    <link rel="Stylesheet" type="text/css" href="style.css" />
    <script language="javascript" type="text/javascript" for="BioPlugInActX"               event="OnCapture()">
        //  get template data
        document.getElementById("Leftbiodata").value = BioPlugInActX.GetSafeLeftFingerData();
        document.getElementById("Rightbiodata").value = BioPlugInActX.GetSafeRightFingerData();     
        if (document.getElementById("btnCapture_Double").disabled == false) {
                document.getElementById("btnVerify_Double").disabled = false;
            }
        else {
            document.getElementById("btnVerify_Single").disabled = false;
        }   
    </script>

    <script type="text/javascript" language="javascript">      

        function StartCapture_Double() {
            // Capture template for double hand/finger for verify
            BioPlugInActX.CaptureVerifyShortFingerData();
        }

        function StartCapture_Single() {
            // Capture template for single hand/finger for verify
            BioPlugInActX.CaptureVerifySingleShortFingerData();
        }
        function onOpClick(bValue) {
            document.getElementById("btnCapture_Double").disabled = !bValue;
            document.getElementById("btnCapture_Single").disabled = bValue;
        }
    </script>

    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <table cellpadding="0px" cellspacing="0px" align="center">
            <tr>
                <td>
                <table>            
                    <tr>
                        <td class="pagetitle"><asp:LinkButton ID="lnlCurrentEngine" runat="server" PostBackUrl="~/Default.aspx">Current Engine</asp:LinkButton></td>
                        <td>:</td>
                        <td><asp:Label ID="lblEngineType" runat="server" Text="" CssClass="pagetitleValue"></asp:Label></td>
                    </tr>
                    <tr>
                        <td class="pagetitle2"><asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="~/frmOperations.aspx">Operation</asp:LinkButton></td>
                        <td>:</td>
                        <td><asp:Label ID="lblOperation" runat="server" CssClass="pagetitleValue2" Text=""></asp:Label></td>
                    </tr>
                    <tr><td colspan="3"><hr /></td></tr> 
                </table>

                 <fieldset style="width:350px;">
                    <legend>
                        <input type="radio" name="finger" value="dfinger"   onclick="onOpClick(true)" checked="checked" />
                        <asp:Label ID="lblScanFingerDouble" runat="server" Text="Double finger"></asp:Label>
                    </legend>
                       <table cellpadding="3px" cellspacing="0">
                            <tr>
                                <td width="120px">Registration ID</td>   
                                <td>
                                    <asp:TextBox ID="txtRegID_D" Width="150px" runat="server"></asp:TextBox>
                                </td>     
                            </tr>
                            <tr>
                                <td>
                                    <input id="btnCapture_Double" type="button" value="Capture" onclick="StartCapture_Double();" /> 
                                </td>
                                <td>
                                    <asp:Button ID="btnVerify_Double" runat="server" Text="Verify" Enabled="false" 
                                        onclick="btnVerify_Double_Click" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:HiddenField ID="Leftbiodata" runat="server" />
                                    <asp:HiddenField ID="Rightbiodata" runat="server" />
                                </td>
                            </tr>  
                        </table>
                   </fieldset>
                   <br /><br />
                   <fieldset style="width:350px;">
                        <legend>
                        <input type="radio" name="finger" value="dfinger"  onclick="onOpClick(false)" />
                        <asp:Label ID="lblScanFingerSingle" runat="server" Text="Single finger"></asp:Label>
                    </legend>
                       <table cellpadding="3px" cellspacing="0">
                            <tr>
                                <td width="120px">Registration ID</td>   
                                <td>
                                    <asp:TextBox ID="txtRegID_S" Width="150px" runat="server"></asp:TextBox>
                                </td>     
                            </tr>
                            <tr>
                                <td >
                                    <input id="btnCapture_Single" type="button" value="Capture" disabled="disabled" onclick="StartCapture_Single();" /> 
                                </td>
                                <td>
                                    <asp:Button ID="btnVerify_Single" runat="server" Text="Verify" Enabled="false" 
                                        onclick="btnVerify_Single_Click" />
                                </td>
                            </tr>
                        </table>
                   </fieldset>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

/////////////////////////////////////////////// //////////////////////////////

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BPWebApplication;

namespace BioPluginWebApp
{
    public partial class Verification : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblEngineType.Text = SessionManager.CurrentEngine.ToString();
                lblOperation.Text = BPOperationType.Verification.ToString();
                if (SessionManager.CurrentEngine == EngineType.PalmVein)
                {
                    lblScanFingerDouble.Text = "Double hand";
                    lblScanFingerSingle.Text = "Single hand";
                }
            }
        }
        protected void btnVerify_Single_Click(object sender, EventArgs e)
        {
            SessionManager.CurrentScanFinger = BPScanFinger.Single;
            PrepareTemplate();
          //  Response.Redirect("ProcessOperation.aspx");
        }

        protected void btnVerify_Double_Click(object sender, EventArgs e)
        {
            SessionManager.CurrentScanFinger = BPScanFinger.Double;
            PrepareTemplate();
           // Response.Redirect("ProcessOperation.aspx");
        }

        private void PrepareTemplate()
        {
            BPData template = new BPData
            {
                LeftTemplate = Leftbiodata.Value,
                RightTemplate = Rightbiodata.Value,
                LeftDupTemplate = string.Empty,
                RightDupTemplate = string.Empty,
                RegID = (SessionManager.CurrentScanFinger == BPScanFinger.Double) ? txtRegID_D.Text.Trim() : txtRegID_S.Text.Trim()
            };
            SessionManager.CurrentTemplate = template;
            SessionManager.CurrentOperation = BPOperationType.Verification;
        }

    }
}

/////////////////////////////////////////////// ////////////////////////////

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProcessOperation.aspx.cs" Inherits="BioPluginWebApp.ProcessOperation" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ProcessOperations</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table cellpadding="0px" cellspacing="0px" align="center">
            <tr>
                <td>
                <table>            
                    <tr>
                        <td class="pagetitle"><asp:LinkButton ID="lnlCurrentEngine" runat="server" PostBackUrl="~/Default.aspx">Current Engine</asp:LinkButton></td>
                        <td>:</td>
                        <td><asp:Label ID="lblEngineType" runat="server" Text="" CssClass="pagetitleValue"></asp:Label></td>
                    </tr>
                    <tr>
                        <td class="pagetitle2">Operation</td>
                        <td>:</td>
                        <td><asp:Label ID="lblOperation" runat="server" CssClass="pagetitleValue2" Text=""></asp:Label></td>
                    </tr>
                    <tr><td colspan="3"><hr /></td></tr> 
                </table>
                <br />
                <asp:Label ID="lblResult" runat="server" CssClass="pagetitleValue" Text=""></asp:Label>
                <br />
                <br />
                <table cellpadding="3px" cellspacing="0">
                    <tr><td><a href="Default.aspx">Back To Engines</a></td></tr>        
                    <tr><td><a href="Operation.aspx">Back To Operations</a></td></tr>  
                </table>
                </td>
            </tr>
        </table>
    </div>
    </form>
    </body>
    </html>

/////////////////////////////////////////////// //////////////////////////

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BPWebApplication;

namespace BioPluginWebApp
{
    public partial class ProcessOperation : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblEngineType.Text = SessionManager.CurrentEngine.ToString();
                lblOperation.Text = SessionManager.CurrentOperation.ToString();
                ProcessData();
            }
        }
        private void ProcessData()
        {
            BPOperationType option = SessionManager.CurrentOperation;
            switch (option)
            {
                case BPOperationType.Enrollment:
                    Enrollment();
                    break;
                case BPOperationType.Identification:
                    Identification();
                    break;
                case BPOperationType.Verification:
                    Verification();
                    break;
                case BPOperationType.Update:
                    Update();
                    break;
                default:
                    break;
            }
        }
        private void Enrollment()
        {
            try
            {
                // bioplugin web service
                bioPluginService.BioPluginService ob = new BioPluginWebApp.bioPluginService.BioPluginService();

                //captured template
                BPData template = SessionManager.CurrentTemplate;
                string result = string.Empty;
                if (SessionManager.CurrentEngine == EngineType.PalmVein || SessionManager.CurrentEngine == EngineType.FingerVein)
                {
                    if (SessionManager.CurrentScanFinger == BPScanFinger.Double)
                    { result = ob.RegisterEx(template.RegID, template.LeftTemplate, 1, template.RightTemplate, 1, template.LeftDupTemplate, template.RightDupTemplate, 1);
                    }
                    else
                    {
                       result = ob.RegisterEx(template.RegID, template.LeftTemplate, 1, template.LeftTemplate, 1, template.LeftDupTemplate, template.LeftDupTemplate, 1);
                     }
                }
                else
                {
                    if (SessionManager.CurrentScanFinger == BPScanFinger.Double)
                    {
                        //double finger enrollment except palmvein
                        result = ob.RegisterEx(template.RegID,template.LeftTemplate, 1, template.RightTemplate, 1,template.LeftTemplate,template.RightTemplate , 1);
                    }
                    else
                    {
                        //single finger enrollment except palmvein
                        result = ob.RegisterEx(template.RegID,template.LeftTemplate, 1,template.LeftTemplate,1,template.LeftTemplate,template.LeftTemplate , 1);
                    }
                }
                ProcessResult(result);
            }
            catch (Exception ex)
            {
                lblResult.Text = ex.Message;
            }
        }

        protected void Identification()
        {
            try
            {
                // bioplugin web service
                bioPluginService.BioPluginService ob = new BioPluginWebApp.bioPluginService.BioPluginService();

                // captured template
                BPData template = SessionManager.CurrentTemplate;
                string result = string.Empty;
                result = ob.IdentifyQuick(template.LeftTemplate, 0, 1, 1);
                ProcessResult(result);
            }
            catch (Exception ex)
            {
                lblResult.Text = ex.Message;
            }
        }

        protected void Verification()
        {
            try
            {
                bioPluginService.BioPluginService ob = new BioPluginWebApp.bioPluginService.BioPluginService();

                BPData template = SessionManager.CurrentTemplate;
                string result = string.Empty;

                if (SessionManager.CurrentScanFinger == BPScanFinger.Double)
                {
                    //double hand/finger verification
                    result = ob.Verify(template.LeftTemplate, template.RightTemplate, template.RegID, 1);
                }
                else
                {
                    //single hand/finger verification
                    result = ob.VerifySingle(template.LeftTemplate, template.RegID, 1);
                }

                ProcessResult(result);
            }
            catch (Exception ex)
            {
                lblResult.Text = ex.Message;
            }
        }

        protected void Update()
        {
            try
            {
                bioPluginService.BioPluginService ob = new BioPluginWebApp.bioPluginService.BioPluginService();

                BPData template = SessionManager.CurrentTemplate;
                string result = string.Empty;

                if (SessionManager.CurrentEngine == EngineType.PalmVein || SessionManager.CurrentEngine == EngineType.FingerVein)
                {
                    if (SessionManager.CurrentScanFinger == BPScanFinger.Double)
                    {
                        //Palmvein double hand update
                        result = ob.UpdateEx(template.RegID,template.LeftTemplate, 1, template.RightTemplate, 1,template.LeftDupTemplate,template.RightDupTemplate , 1);
                    }
                    else
                    {
                        //Palmvein single hand update
                        result = ob.UpdateEx(template.RegID,template.LeftTemplate, 1, template.LeftTemplate, 1,template.LeftTemplate,template.LeftTemplate , 1);
                    }
                }
                else
                {
                    if (SessionManager.CurrentScanFinger == BPScanFinger.Double)
                    {
                        //single finger update except palmvein
                        result = ob.UpdateEx(template.RegID,template.LeftTemplate, 1, template.RightTemplate, 1,template.LeftTemplate,template.RightTemplate , 1);
                    }
                    else
                    {
                        //single finger update except palmvein
                        result = ob.UpdateEx(template.RegID,template.LeftTemplate, 1,template.LeftTemplate,1,template.LeftTemplate,template.LeftTemplate , 1);
                    }

                }
                ProcessResult(result);
            }
            catch (Exception ex)
            {
                lblResult.Text = ex.Message;
            }
        }

        private void ProcessResult(string result)
        {
            lblResult.Visible = true;

            switch (result)
            {

                case "SUCCESS":
                    lblResult.Text = string.Format("{0} successfull.", SessionManager.CurrentOperation.ToString());
                    break;
                case "LICENSE_ERROR":
                    lblResult.Text = "License related problem orccured.";
                    break;
                case "INVALID_ENGINE":
                    lblResult.Text = "Requested engine is invalid.";
                    break;
                case "-1":
                    if (SessionManager.CurrentOperation == BPOperationType.Enrollment)
                        lblResult.Text = "Enrollment ID exist in the system";
                    else if (SessionManager.CurrentOperation == BPOperationType.Identification)
                        lblResult.Text = String.Format("Your {0} is not in the system.", SessionManager.CurrentEngine.ToString());
                    else
                        lblResult.Text = "Biometric operation failed.";
                    break;
                case "0":
                  //  lblResult.Text = "Verified successfully.";
                    break;
                case "":
                    lblResult.Text = "Web service connection failed.";
                    break;
                case "-411":
                    lblResult.Text = "Bioplugin server connection timeout. Please try again.";
                    break;
                default:
                    lblResult.Text = "Template found in the system with ID - " + result;
                    break;
            }
        }

    }
}

0 个答案:

没有答案