.Net源码论坛 [ 繁体中文 ]

发新话题 回复该主题

提交form表单问题 [复制链接]

楼主
公司搞了一个第三方网银支付代码,原来以为是网银,原来是网付通,那边只给JAVA和了一段C#代码的接口代码,这个要怎样写提交表单到这代码运行?自已搞PHP的,不太会C#,这个要怎样写FORM提交表单到这代码运行?源文件已打包。。



附件:您需要登录才可以下载或查看附件。没有帐号? 注册
分享 转发
TOP
沙发

  1. private void TestPayReq()
  2.         {

  3.     //请求报文
  4.             String url = "http://59.41.103.98:333/gzdsf/ProcessServlet";
  5.             String strSendData = "<?xml version=\"1.0\" encoding=\"GBK\"?><GZELINK><INFO><TRX_CODE>100002</TRX_CODE><VERSION>04</VERSION><DATA_TYPE>2</DATA_TYPE><LEVEL>0</LEVEL><USER_NAME>operator</USER_NAME><USER_PASS>1</USER_PASS><REQ_SN>12517936711405</REQ_SN><SIGNED_MSG></SIGNED_MSG></INFO><BODY><TRANS_SUM><BUSINESS_CODE>00600</BUSINESS_CODE><MERCHANT_ID>001053110000001</MERCHANT_ID><SUBMIT_TIME>20090416120000</SUBMIT_TIME><TOTAL_ITEM>2</TOTAL_ITEM><TOTAL_SUM>2</TOTAL_SUM></TRANS_SUM><TRANS_DETAILS><TRANS_DETAIL><SN>0001</SN><E_USER_CODE/><BANK_CODE>105</BANK_CODE><ACCOUNT_TYPE>00</ACCOUNT_TYPE><ACCOUNT_NO>60138270140042110021</ACCOUNT_NO><ACCOUNT_NAME>张三</ACCOUNT_NAME><PROVINCE>广东</PROVINCE><CITY>广州</CITY><BANK_NAME>建行</BANK_NAME><ACCOUNT_PROP>0</ACCOUNT_PROP><AMOUNT>1</AMOUNT><CURRENCY>CNY</CURRENCY><PROTOCOL/><PROTOCOL_USERID/><ID_TYPE/><ID/><TEL/><CUST_USERID/><REMARK>保险理赔</REMARK></TRANS_DETAIL><TRANS_DETAIL><SN>0002</SN><E_USER_CODE/><BANK_CODE>105</BANK_CODE><ACCOUNT_TYPE>00</ACCOUNT_TYPE><ACCOUNT_NO>60138270140042110022</ACCOUNT_NO><ACCOUNT_NAME>李四</ACCOUNT_NAME><PROVINCE>广东</PROVINCE><CITY>广州</CITY><BANK_NAME>建行</BANK_NAME><ACCOUNT_PROP>0</ACCOUNT_PROP><AMOUNT>1</AMOUNT><CURRENCY>CNY</CURRENCY><PROTOCOL/><PROTOCOL_USERID/><ID_TYPE/><ID/><TEL/><CUST_USERID/><REMARK>保险理赔</REMARK></TRANS_DETAIL></TRANS_DETAILS></BODY></GZELINK>";


  6.     String resultStrSendData = this.signMsg(strSendData);
  7.             String strResp = "";

  8.     try
  9.             {
  10.                 this.WriteLogFile("【开始调用URL,写入URL数据】" + resultStrSendData);
  11.                 strResp = PostData(url, resultStrSendData, "GBK");
  12.                 this.WriteLogFile("【URL返回的结果】"+strResp+"【开始验签】");
  13.                 this.verifySign(strResp);

  14.     }
  15.             catch (Exception e) {
  16.                 this.WriteLogFile( e.ToString() );

  17.     }
  18.         }
复制代码
主要是这里,strSendData 里面很多参数需要对照说明文档格式设置。url是回调地址,然后根据返回结果做判断。他们提供的接口什么语言都可以调用。不一定非要用c#实现。多看看api那个说明文档
参与论坛,奖励积分(积分=共享分)
奖励范围:
1、积极回答解决问题的用户
2、积极发帖的用户(技术文章等学习资料)
TOP
板凳

要C#,我试过直接PHP POST过去,没反应,因为要数字签名,还要安装DLL到服务器。。
TOP
地板


自已试写了一段代码,提示这个错误了。

<%@ Page Language="C#" AutoEventWireup="true"   CodeFile="pay.aspx.cs" Inherits="dsf.pay"  %>
<!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 >
    <title>无标题页</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio 7.0"/>
    <meta name="CODE_LANGUAGE" content="C#"/>
        <meta name="vs_defaultClientScript" content="JavaScript"/>
        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"/>
</head>
<body>
    <form id="WebForm1" runat="server">
        <aspextbox ID="tb" runat="server"></aspextbox>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Submit" />
        <br />
        <br />
        <aspabel ID="Label2" runat="server" Text="Label"></aspabel>
    </form>
</body>
</html>


pay.aspx.cs

using System;
using System.Text;
using com.gnete;
using System.IO;
using System.Runtime.InteropServices;
using System.Net;
using System.Collections.Specialized;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Security.Cryptography;
namespace dsf.Web.UI
{

    public class pay : System.Web.UI.Page

    {



Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).

Source Error:



Line 1:  using System;
Line 2:  using System.Text;
Line 3:  using com.gnete;
TOP
五楼

Inherits="dsf.pay"  页面中这里有问题,试试这样 Inherits="dsf.Web.UI.pay"
参与论坛,奖励积分(积分=共享分)
奖励范围:
1、积极回答解决问题的用户
2、积极发帖的用户(技术文章等学习资料)
TOP
六楼

自已修改加了aspx,现在能显出界面,不过点按钮没反应。想点按钮就跳到那个验证页看看效果。。
您所在的用户组无法下载或查看附件
TOP
发新话题 回复该主题