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");
我遇到过类似的问题,几年前我在互联网上发现了这个 class
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();
}
}
然后在您的按钮点击事件中使用如下
remotepost mrp = new remotepost();
mrp.Url = "https://Simplecheckout.authorize.net/payment/CatalogPayment.aspx";
mrp.Add("LinkId",VALUEHERE);
mrp.Post();
我正在使用 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");
我遇到过类似的问题,几年前我在互联网上发现了这个 class
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();
}
}
然后在您的按钮点击事件中使用如下
remotepost mrp = new remotepost();
mrp.Url = "https://Simplecheckout.authorize.net/payment/CatalogPayment.aspx";
mrp.Add("LinkId",VALUEHERE);
mrp.Post();