如何在指纹设备的mvc中制作项目 [英] How to make a project in mvc of fingerprint device

查看:57
本文介绍了如何在指纹设备的mvc中制作项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



我有一个指纹设备项目。

我是.net新手。如果有人可以帮我解决问题。



我的问题是当我跳转到同一控制器的另一种方法时,设备会自动关闭。







代码在这里



<前lang = c#> 使用系统;
使用 System.Collections.Generic;
使用 System.Linq;
使用 System.Web;
使用 SecuGen.FDxSDKPro.Windows;
使用 System.Drawing;
使用 System.Windows.Forms;
使用 System.IO;
使用 System.Drawing.Imaging;
使用 System.Web.Mvc;
使用 System.Data;

使用 System.Drawing.Drawing2D;

命名空间 MvcApplication2.Models
{
public class Dis
{
private bool m_useAnsiTemplate = false ;
public bool m_DeviceOpened;
public Byte [] m_StoredTemplate = null < /跨度>;
public Int32 m_ImageWidth = 300 ;
public Int32 m_ImageHeight = 400 ;
public Int32 m_Dpi = 500 ;
public SGFingerPrintManager m_FPM = new SGFingerPrintManager();
public 字节 [] m_RegMin1 = null < /跨度>;
public Byte [] m_RegMin2 = null < /跨度>;
public Byte [] m_VrfMin;
Int32 device_id;
Int32 error = 0 ;

private SGFPMSecurityLevel m_SecurityLevel = SGFPMSecurityLevel.NORMAL;

SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN;
public void initialize()
{
m_DeviceOpened = ;
Int32 错误;

device_id =( Int32 )SGFPMPortAddr.USB_AUTO_DETECT;

device_name = SGFPMDeviceName.DEV_AUTO;
if (device_name!= SGFPMDeviceName.DEV_UNKNOWN)
{
error = m_FPM.Init(device_name);

if (error ==( Int32 )SGFPMError.ERROR_NONE)
{
m_FPM.CloseDevice();
error = m_FPM.OpenDevice(device_id);
}

if (错误==( Int32 )SGFPMError .ERROR_NONE)
{
SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam();
m_FPM.GetDeviceInfo(pInfo);
m_ImageWidth = pInfo.ImageWidth;
m_ImageHeight = pInfo.ImageHeight;
}
}
else
error = m_FPM.InitEx(m_ImageWidth,m_ImageHeight,m_Dpi);

error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ISO19794);


// 获取最大模板大小
Int32 max_template_size = 0 ;
error = m_FPM.GetMaxTemplateSize( ref max_template_size);

m_RegMin1 = new 字节 [max_template_size];
m_RegMin2 = new Byte [max_template_size];
m_VrfMin = new 字节 [max_template_size];


HttpContext.Current.Session [ data1] = m_RegMin1;

// 如果选择了设备,则为OpenDevice
if (device_name!= SGFPMDeviceName.DEV_UNKNOWN)
{
error = m_FPM.OpenDevice(device_id);
if (错误==( Int32 )SGFPMError.ERROR_NONE)
{
m_DeviceOpened = true ;
HttpContext.Current.Session [ deviceStatus] = m_DeviceOpened;
}
}
error = m_FPM.OpenDevice(device_id);
}


public 图片BtnCapture1_Click(图片nq)
{

var dS = HttpContext.Current.Session [ deviceStatus ];
字节 [] fp_image = new 字节 [m_ImageWidth * m_ImageHeight];
error =( Int32 )SGFPMError.ERROR_NONE;
Int32 img_qlty = 0 ;
if (m_DeviceOpened == false
initialize();

// 获取最大模板大小
if (m_DeviceOpened)
error = m_FPM.GetImage(fp_image);
if (错误==( Int32 )SGFPMError.ERROR_NONE)
{
m_FPM.GetImageQuality(m_ImageWidth,m_ImageHeight,fp_image, ref img_qlty);
}

Image nt = DrawImage(fp_image,nq);
SGFPMFingerInfo finger_info = new SGFPMFingerInfo();

finger_info.ImageQuality =( Int16 )img_qlty;
finger_info.ImpressionType =( Int16 )SGFPMImpressionType.IMPTYPE_LP;
finger_info.ViewNumber = 1 ;

error = m_FPM.CreateTemplate(finger_info,fp_image,m_RegMin1);
HttpContext.Current.Session [ reg1] = m_RegMin1;
return nt;
}



public 图片BtnCapture2_Click(图片nq)
{
字节 [] fp_image = new 字节 [m_ImageWidth * m_ImageHeight];
error =( Int32 )SGFPMError.ERROR_NONE;
Int32 img_qlty = 0 ;
if (m_DeviceOpened == false
initialize();

// 获取最大模板大小
if (m_DeviceOpened)
error = m_FPM.GetImage(fp_image);


if (错误==( Int32 )SGFPMError。 ERROR_NONE)
{
m_FPM.GetImageQuality(m_ImageWidth,m_ImageHeight,fp_image, ref img_qlty);
}

Image nt = DrawImage(fp_image,nq);
SGFPMFingerInfo finger_info = new SGFPMFingerInfo();

finger_info.ImageQuality =( Int16 )img_qlty;
finger_info.ImpressionType =( Int16 )SGFPMImpressionType.IMPTYPE_LP;
finger_info.ViewNumber = 1 ;

error = m_FPM.CreateTemplate(finger_info,fp_image,m_RegMin2);
HttpContext.Current.Session [ reg2] = m_RegMin2;

return nt;
}


public void register(< span class =code-keyword> string
Usernm, string password1, string password2)
{
var RegMin1 = HttpContext.Current.Session [ REG1\" ];
var RegMin2 = HttpContext.Current.Session [ REG2];

bool matched = false ;
Int32 err = 0 ;
err = m_FPM.MatchTemplate(RegMin1 as Byte [],RegMin2 as 字节 [],m_SecurityLevel, ref 匹配);


if ((err ==( Int32 )SGFPMError .ERROR_NONE))
{
如果(匹配)
{
// 合并两个模板后保存模板 - m_FetBuf1,m_FetBuf2
字节 [ ] merged_template;
Int32 buf_size = 0 ;

if (m_useAnsiTemplate)
{
m_FPM.GetTemplateSizeAfterMerge(m_RegMin1,m_RegMin2, ref buf_size);
merged_template = new 字节 [buf_size];
m_FPM.MergeAnsiTemplate(m_RegMin1,m_RegMin2,merged_template);
}
else
{
m_FPM.GetIsoTemplateSizeAfterMerge(m_RegMin1,m_RegMin2, ref buf_size);
merged_template = new 字节 [buf_size];
m_FPM.MergeIsoTemplate(m_RegMin1,m_RegMin2,merged_template);
}

if (m_StoredTemplate == null
{
m_StoredTemplate = new 字节 [buf_size];
merged_template.CopyTo(m_StoredTemplate, 0 );
}
else
{
Int32 new_size = 0 ;

if (m_useAnsiTemplate)
{
err = m_FPM.GetTemplateSizeAfterMerge(m_StoredTemplate,merged_template, ref new_size);
}
else
{
err = m_FPM.GetIsoTemplateSizeAfterMerge(m_StoredTemplate,merged_template, ref new_size);
}

字节 [] new_enroll_template = new 字节 [new_size];

if (m_useAnsiTemplate)
{
err = m_FPM.MergeAnsiTemplate(merged_template,m_StoredTemplate,new_enroll_template);
}
else
{
err = m_FPM.MergeIsoTemplate(merged_template,m_StoredTemplate,new_enroll_template);
}

m_StoredTemplate = new 字节 [new_size];

new_enroll_template.CopyTo(m_StoredTemplate, 0 );
}
// 让我们显示ANSI / ISO模板信息
}
}
}


私人图像DrawImage(字节 [] imgData,Image picBox)
{
int colorval;
位图bmp = new 位图(m_ImageWidth,m_ImageHeight);
picBox =(图片)bmp;

for int i = 0 ; i < bmp.Width; i ++)
{
for int j = 0 ; j < ; bmp.Height; j ++)
{
colorval =( int )imgData [(j * m_ImageWidth)+ i];
bmp.SetPixel(i,j,Color.FromArgb(colorval,colorval,colorval));
}
}
Image nt = picBox;
return nt;
}
}
}





这是控制器



 使用系统; 
使用 System.Collections.Generic;
使用 System.Linq;
使用 System.Web;
使用 System.Web.Mvc;
使用 SecuGen.FDxSDKPro.Windows;
使用 MvcApplication2.Models;
使用 System.IO;

使用 System.Windows.Forms;

使用 System.Drawing;

使用 System.ComponentModel;

使用 System.Data;
使用 System.IO;
使用 System.Drawing.Imaging; // .StreamReader;

namespace MvcApplication2.Controllers
{
public class NewController:Controller
{
public ActionResult Index()
{

return View();
}

public string capture()
{
string a = Url.Action( SomeImage Image);
返回 a;
}
public string capture1()
{
string b = Url.Action( SomeImage1 图像);

return b;
}
[HttpPost]
public ActionResult reg( string Usernm , string password1, string password2)
{
Dis dis = new Dis();
dis.register(Usernm,password1,password2);

return 查看( 索引);
}
}
}





 使用系统; 
使用 System.Collections.Generic;
使用 System.Linq;
使用 System.Web;
使用 System.Web.Mvc;
使用 MvcApplication2.Models;
使用 System.Drawing;
使用 System.Drawing.Imaging;
使用 System.IO;
命名空间 MvcApplication2.Controllers
{
public class ImageController:Controller
{

public ActionResult SomeImage()
{

Dis dis = new Dis();
图片nq = null ;
图片a = dis.BtnCapture1_Click(nq);
string filepath = @ E:\\ \\SourceCode\MvcApplication2\MvcApplication2\Models\Images\1.bmp;
a.Save( @ E:\ SourceCode \ MVcApplication2 \ MVcApplication2 \ Model# Images\1.bmp);
return 文件(filepath, image / BMP);
}

public ActionResult SomeImage1()
{

Dis dis = new Dis();
图片nq = null ;
图片a = dis.BtnCapture2_Click(nq);
string filepath = @ E:\\ \\SourceCode\MvcApplication2\MvcApplication2\Models\Images\2.bmp;
a.Save( @ E:\ SourceCode \ MVcApplication2 \ MVcApplication2 \ Model# Images\2.bmp);
return 文件(filepath, image / BMP);
}

}
}





这是我的观点



 @ {
布局= null ;
}
@using MvcApplication2.Models;
<!DOCTYPE html>

< html>
< head>
< meta name = viewport content = width = device-width />
< title>新用户< / title >
< script src = ../../ Script / script.js type = text / javascript > < / script >
< script src = ../../ Script / jquery-1.11.2.js type = text / javascript > < / script >
< script src = ../../ Script / filter.js type = text / javascript > < / script >
< link href = < span class =code-string> ../../ StyleSheet.css rel = 样式表 type = text / css />
< / head >
< body>

< div class = mydiv1 >
< div id = Aut >
< label>输入分支代码< / label >
@ Html.TextBox( BrnCd )< br />


< label>密码< / label < span class =code-keyword>>
@ Html.TextBox( password );

< / div >
< div id = login >
< div id = login1 >
< label>用户名< / label >
@ Html.TextBox( Usernm )< br />
< label>密码< / label >
@ Html.TextBox( password1 )< br />
< label>确认密码< / label >
@ Html.TextBox( password2,< span class =code-string> );
< / div >
< table>
< tr>
< td>
< div class = im id = im1 >

@ *< img id = cap2 src = @ ViewBag.imge alt = /> * @
< / div >
< button id = C1 class = capture @ * onclick = location.href ='@ Url.Action( capture )' * @>捕获图像 1 < / 按钮 >
< / td >
< td>
< div class = im id = im2 >

@ *< img id = cap2 src = @ ViewBag.imge alt = /> * @
< / div >
< button id = C2 class = capture @ * onclick = location.href ='@ Url.Action( capture1 )' * @>捕获图像 2 < / 按钮 >
< / td >
< / tr >
< / table >
< div id = sub >
< button id = R class = capture @ * onclick = location。 href ='@ Url.Action( capture1 )' * @>注册< / 按钮 >
< / div >
< label> @ ViewBag.status < / 标签 >

< / div >
< / 正文 >



< / html >
< script type=\"text/javascript\" >
$(\"#C1\").click(function( ){

$.ajax({
type: \"GET\",
url: '@Url.Action(\"capture\", \"New\")',
contentType: \"string\",


success: function(data){
$('#im1').html('<img id=\"cap1\" src=\"' + data + '\" />');
}
} );
});


$(\"#C2\").click(function () {

$.ajax({
type: \"GET\",
url: '@Url.Action(\"capture1\", \"New\")',
contentType: \"string\",


success: function (data) {
$('#im2').html('<img id=\"cap2\" src=\"' + data + '\" />');
}
});
});

$(\"#R\").click(function () {

$.ajax({
type: \"POST\",
url: '@Url.Action(\"Reg\", \"New\")',
contentType: \"string\",


success: function (data) {
$('#im2').html('<img id=\"cap2\" src=\"' + data + '\" />');
}
});
});
</script></div>

解决方案

(\"#C1\").click(function(){


.ajax({
type: \"GET\",
url: '@Url.Action(\"capture\", \"New\")',
contentType: \"string\",


success: function(data){


('#im1').html('<img id=\"cap1\" src=\"' + data + '\" />');
}
} );
});


Hello

I have a project of finger print device.
I am new in .net. If some one can help me out my.

My problem is "device is turned off automatically when i jump to another method of same controller".



Code is here

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SecuGen.FDxSDKPro.Windows;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Imaging;
using System.Web.Mvc;
using System.Data;

using System.Drawing.Drawing2D;

namespace MvcApplication2.Models
{
    public class Dis
    {
        private bool m_useAnsiTemplate = false;
        public bool m_DeviceOpened;
        public Byte[] m_StoredTemplate = null;
        public Int32 m_ImageWidth = 300;
        public Int32 m_ImageHeight = 400;
        public Int32 m_Dpi = 500;
        public SGFingerPrintManager m_FPM = new SGFingerPrintManager();
        public Byte[] m_RegMin1 = null;
        public Byte[] m_RegMin2 = null;
        public Byte[] m_VrfMin;
        Int32 device_id;
        Int32 error = 0;
     
        private SGFPMSecurityLevel m_SecurityLevel = SGFPMSecurityLevel.NORMAL;

        SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN;
        public void initialize()
        {
            m_DeviceOpened = false;
            Int32 error;
            
            device_id = (Int32)SGFPMPortAddr.USB_AUTO_DETECT;

            device_name = SGFPMDeviceName.DEV_AUTO;
            if (device_name != SGFPMDeviceName.DEV_UNKNOWN)
            {
                error = m_FPM.Init(device_name);

                if (error == (Int32)SGFPMError.ERROR_NONE)
                {
                    m_FPM.CloseDevice();
                    error = m_FPM.OpenDevice(device_id);
                }

                if (error == (Int32)SGFPMError.ERROR_NONE)
                {
                    SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam();
                    m_FPM.GetDeviceInfo(pInfo);
                    m_ImageWidth = pInfo.ImageWidth;
                    m_ImageHeight = pInfo.ImageHeight;
                }
            }
            else
                error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi);

            error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ISO19794);


            // Get Max template size
            Int32 max_template_size = 0;
            error = m_FPM.GetMaxTemplateSize(ref max_template_size);

            m_RegMin1 = new Byte[max_template_size];
            m_RegMin2 = new Byte[max_template_size];
            m_VrfMin = new Byte[max_template_size];


            HttpContext.Current.Session["data1"] = m_RegMin1;

            // OpenDevice if device is selected
            if (device_name != SGFPMDeviceName.DEV_UNKNOWN)
            {
                error = m_FPM.OpenDevice(device_id);
                if (error == (Int32)SGFPMError.ERROR_NONE)
                {
                    m_DeviceOpened = true;
                    HttpContext.Current.Session["deviceStatus"] = m_DeviceOpened;
                }
            }
            error = m_FPM.OpenDevice(device_id);
        }


        public Image BtnCapture1_Click(Image nq)
        {
            
            var dS = HttpContext.Current.Session["deviceStatus"];
            Byte[] fp_image = new Byte[m_ImageWidth * m_ImageHeight];
            error = (Int32)SGFPMError.ERROR_NONE;
            Int32 img_qlty = 0;
            if(m_DeviceOpened == false)
            initialize();

            // Get Max template size
            if (m_DeviceOpened)
                error = m_FPM.GetImage(fp_image);
            if (error == (Int32)SGFPMError.ERROR_NONE)
            {
                m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty);
            }

            Image nt = DrawImage(fp_image, nq);
            SGFPMFingerInfo finger_info = new SGFPMFingerInfo();

            finger_info.ImageQuality = (Int16)img_qlty;
            finger_info.ImpressionType = (Int16)SGFPMImpressionType.IMPTYPE_LP;
            finger_info.ViewNumber = 1;

            error = m_FPM.CreateTemplate(finger_info, fp_image,m_RegMin1);
            HttpContext.Current.Session["reg1"] = m_RegMin1;
            return nt;
        }



        public Image BtnCapture2_Click(Image nq)
        {
            Byte[] fp_image = new Byte[m_ImageWidth * m_ImageHeight];
            error = (Int32)SGFPMError.ERROR_NONE;
            Int32 img_qlty = 0;
            if (m_DeviceOpened == false)
            initialize();

            // Get Max template size
            if (m_DeviceOpened)
                error = m_FPM.GetImage(fp_image);


            if (error == (Int32)SGFPMError.ERROR_NONE)
            {
                m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty);
            }

            Image nt = DrawImage(fp_image, nq);
            SGFPMFingerInfo finger_info = new SGFPMFingerInfo();

            finger_info.ImageQuality = (Int16)img_qlty;
            finger_info.ImpressionType = (Int16)SGFPMImpressionType.IMPTYPE_LP;
            finger_info.ViewNumber = 1;

            error = m_FPM.CreateTemplate(finger_info, fp_image, m_RegMin2);
            HttpContext.Current.Session["reg2"] = m_RegMin2;

            return nt;
        }


        public void register(string Usernm, string password1, string password2)
        {
            var RegMin1= HttpContext.Current.Session["reg1"];
            var RegMin2 = HttpContext.Current.Session["reg2"];
           
            bool matched = false;
            Int32 err = 0;
            err = m_FPM.MatchTemplate(RegMin1 as Byte[], RegMin2 as Byte[], m_SecurityLevel, ref matched);


            if ((err == (Int32)SGFPMError.ERROR_NONE))
            {
                if (matched)
                {
                    // Save template after merging two template - m_FetBuf1, m_FetBuf2
                    Byte[] merged_template;
                    Int32 buf_size = 0;

                    if (m_useAnsiTemplate)
                    {
                        m_FPM.GetTemplateSizeAfterMerge(m_RegMin1, m_RegMin2, ref buf_size);
                        merged_template = new Byte[buf_size];
                        m_FPM.MergeAnsiTemplate(m_RegMin1, m_RegMin2, merged_template);
                    }
                    else
                    {
                        m_FPM.GetIsoTemplateSizeAfterMerge(m_RegMin1, m_RegMin2, ref buf_size);
                        merged_template = new Byte[buf_size];
                        m_FPM.MergeIsoTemplate(m_RegMin1, m_RegMin2, merged_template);
                    }

                    if (m_StoredTemplate == null)
                    {
                        m_StoredTemplate = new Byte[buf_size];
                        merged_template.CopyTo(m_StoredTemplate, 0);
                    }
                    else
                    {
                        Int32 new_size = 0;

                        if (m_useAnsiTemplate)
                        {
                            err = m_FPM.GetTemplateSizeAfterMerge(m_StoredTemplate, merged_template, ref new_size);
                        }
                        else
                        {
                            err = m_FPM.GetIsoTemplateSizeAfterMerge(m_StoredTemplate, merged_template, ref new_size);
                        }

                        Byte[] new_enroll_template = new Byte[new_size];

                        if (m_useAnsiTemplate)
                        {
                            err = m_FPM.MergeAnsiTemplate(merged_template, m_StoredTemplate, new_enroll_template);
                        }
                        else
                        {
                            err = m_FPM.MergeIsoTemplate(merged_template, m_StoredTemplate, new_enroll_template);
                        }

                        m_StoredTemplate = new Byte[new_size];

                        new_enroll_template.CopyTo(m_StoredTemplate, 0);
                    }
                    // Let's display ANSI/ISO template Info
                }
            }
        }


        private Image DrawImage(Byte[] imgData, Image picBox)
        {
            int colorval;
            Bitmap bmp = new Bitmap(m_ImageWidth, m_ImageHeight);
            picBox = (Image)bmp;

            for (int i = 0; i < bmp.Width; i++)
            {
                for (int j = 0; j < bmp.Height; j++)
                {
                    colorval = (int)imgData[(j * m_ImageWidth) + i];
                    bmp.SetPixel(i, j, Color.FromArgb(colorval, colorval, colorval));
                }
            }
            Image nt = picBox;
            return nt;
        }
    }
}



This Is The Controller

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SecuGen.FDxSDKPro.Windows;
using MvcApplication2.Models;
using System.IO;

using System.Windows.Forms;

using System.Drawing;

using System.ComponentModel;

using System.Data;
using System.IO;
using System.Drawing.Imaging;//.StreamReader;

namespace MvcApplication2.Controllers
{
    public class NewController : Controller
    {
        public ActionResult Index()
        {
           
            return View();
        }
    
        public string capture()
        {
            string a = Url.Action("SomeImage", "Image");
            return a;
        }
        public string capture1()
        {
            string b = Url.Action("SomeImage1", "Image");
            
            return b;
        }
        [HttpPost]
        public ActionResult reg(string Usernm, string password1, string password2)
        {
            Dis dis = new Dis();
            dis.register(Usernm,password1,password2);
          
            return View("Index");
        }
    }
}



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcApplication2.Models;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace MvcApplication2.Controllers
{
    public class ImageController : Controller
    {

        public ActionResult SomeImage()
        {

            Dis dis = new Dis();
            Image nq = null;
            Image a = dis.BtnCapture1_Click(nq);
            string filepath = @"E:\SourceCode\MvcApplication2\MvcApplication2\Models\Images\1.bmp";
            a.Save(@"E:\SourceCode\MvcApplication2\MvcApplication2\Models\Images\1.bmp");
            return File(filepath, "image/bmp");
        }

        public ActionResult SomeImage1()
        {

            Dis dis = new Dis();
            Image nq = null;
            Image a = dis.BtnCapture2_Click(nq);
            string filepath = @"E:\SourceCode\MvcApplication2\MvcApplication2\Models\Images\2.bmp";
            a.Save(@"E:\SourceCode\MvcApplication2\MvcApplication2\Models\Images\2.bmp");          
            return File(filepath, "image/bmp");
        }

    }
}



This Is my View

@{
    Layout = null;
}
@using MvcApplication2.Models;
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>New User</title>
    <script src="../../Script/script.js" type="text/javascript"></script>
    <script src="../../Script/jquery-1.11.2.js" type="text/javascript"></script>
    <script src="../../Script/filter.js" type="text/javascript"></script>
    <link href="../../StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>

    <div class="mydiv1">
       <div id="Aut">
        <label>Enter Branch Code </label>
        @Html.TextBox("BrnCd","")  <br />
  

        <label>Password</label>
        @Html.TextBox("password", "");
        
        </div>
        <div id="login">
        <div id="login1">
         <label>User Name </label>
        @Html.TextBox("Usernm","")<br />
         <label>Password </label>
        @Html.TextBox("password1", "")<br />
        <label>Confirm Password</label>
        @Html.TextBox("password2", "");
        </div>
        <table>
        <tr>
        <td>
       <div class="im" id="im1">
        
            @*<img id="cap2" src="@ViewBag.imge" alt="" />  *@    
        </div>
        <button id ="C1" class="capture"@* onclick="location.href='@Url.Action("capture", "New")'"*@>Capture Image 1</button>
        </td>
        <td>
        <div class="im" id="im2">
        
            @*<img id="cap2" src="@ViewBag.imge" alt="" />  *@    
        </div>
        <button id="C2" class="capture" @*onclick="location.href='@Url.Action("capture1", "New")'"*@>Capture Image 2</button>
        </td>
        </tr>
            </table>
       <div id="sub">
     <button id="R" class="capture" @*onclick="location.href='@Url.Action("capture1", "New")'"*@>Register</button>
    </div>
    <label>@ViewBag.status</label>

    </div>
   </body>
   
  
   
</html>
<script type="text/javascript">
$("#C1").click(function(){

$.ajax({
  type: "GET",
 url:  '@Url.Action("capture", "New")',
  contentType: "string",
  
  
  success: function(data){
      $('#im1').html('<img id="cap1" src="' + data + '" />');
  }
 } );
});


$("#C2").click(function () {

    $.ajax({
        type: "GET",
        url: '@Url.Action("capture1", "New")',
        contentType: "string",


        success: function (data) {
            $('#im2').html('<img id="cap2" src="' + data + '" />');
        }
    });
});

$("#R").click(function () {

    $.ajax({
        type: "POST",
        url: '@Url.Action("Reg", "New")',
        contentType: "string",


        success: function (data) {
            $('#im2').html('<img id="cap2" src="' + data + '" />');
        }
    });
});
</script></div>

解决方案

("#C1").click(function(){


.ajax({ type: "GET", url: '@Url.Action("capture", "New")', contentType: "string", success: function(data){


('#im1').html('<img id="cap1" src="' + data + '" />'); } } ); });


这篇关于如何在指纹设备的mvc中制作项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆