簡體   English   中英

Aspx,C#和Authorize.Net付款表單-如何實施“授權”按鈕?

[英]Aspx, C#, and Authorize.Net Payment Form - How to implement Authorize button?

我正在使用Visual Studio,C#和ASPX。 我的網頁上有一個可以正常運行的網絡表單。 現在,我想實現一個來自Authorize.Net的付款表格。 下面是Authorize.Net提供的代碼(我出於隱私考慮已刪除了該值):

<form name="PrePage" method = "post" action = "https://Simplecheckout.authorize.net/payment/CatalogPayment.aspx"> <input type = "hidden" name = "LinkId" value ="VALUEHERE" /> <input type = "submit" value = "Register" /> </form>

本質上,我希望我已工作的表單上的提交按鈕重定向到https://Simplecheckout.authorize.net/payment/CatalogPayment.aspx 沒有值字段,此重定向將不起作用。

流程是該人在我的表格上注冊的,然后將他們發送到此付款頁面以支付我在執行上遇到的麻煩的注冊費。 之后,我希望它重定向到我的確認頁面,但是我不確定如何使它工作。

我知道下面可以使用C#重定向我,但是如何附加值字段?

Response.Redirect("https://Simplecheckout.authorize.net/payment/CatalogPayment.aspx");

我有類似的問題,幾年前我在互聯網上找到了這個班

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


public class remotepost
{
    public remotepost()
    {

    }

    private System.Collections.Specialized.NameValueCollection Inputs = new System.Collections.Specialized.NameValueCollection();
    public string Url = "";
    public string Method = "post";
    public string FormName = "form1";
    public string Msg = "elaburating";

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void Add(string name, string value)
    {
        Inputs.Add(name, value);
    }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void Post()
    {
        System.Web.HttpContext.Current.Response.Clear();
        System.Web.HttpContext.Current.Response.Write("<html><head>");
        System.Web.HttpContext.Current.Response.Write(string.Format("</head><body onload=\"document.forms[0].submit()\">", FormName));
        System.Web.HttpContext.Current.Response.Write(string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\">", FormName, Method, Url));

        for(int i=0;i< Inputs.Keys.Count;i++)
        {
            System.Web.HttpContext.Current.Response.Write(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\" >", Inputs.Keys[i], Inputs[Inputs.Keys[i]]));
        }
        System.Web.HttpContext.Current.Response.Write("</form>");
        System.Web.HttpContext.Current.Response.Write(string.Format("<p style=\"font-family:Verdana,Arial; font-size:14px; text-align:center;\">{0}</p>",Msg));
        System.Web.HttpContext.Current.Response.Write("</body></html>");
        System.Web.HttpContext.Current.Response.End();
    }
}

然后在您的buttonclick事件中使用,如下所示

remotepost mrp = new remotepost();
mrp.Url = "https://Simplecheckout.authorize.net/payment/CatalogPayment.aspx";
 mrp.Add("LinkId",VALUEHERE);
  mrp.Post();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM