如何绕过为 paypal 按钮嵌入 html 表单 asp.net
我有一些在 asp.net 网站上使用 PayPal 的经验,但是这个问题让我真的很困惑。
问题的根源:您无法在页面表单中嵌入 paypal 按钮的 html 表单。
原始解决方案:最初我的网站使用多个 aspx 页面,因此我可以简单地排列我的表单标签,这样它们就不会相互嵌入。
我的网站现在使用一个主 aspx 页面,该页面绘制不同的 ascx 控件。这意味着我无法选择在页面周围排列表单标签,因此需要解决方法。
注意。我到处寻找简单的解决方案,但那里就像一片丛林,贝宝是一场噩梦。我确实在 幽灵表单 这一切都是用 c# 编写的。可能有帮助...
提前感谢您的帮助...
I have some experience of using paypal with an asp.net website, however this issue has me really stumped.
Root of the problem: You cant embed the html form for the paypal button inside your page form.
Original solution: Originally my website was using multiple aspx pages so I could simply arrange my form tags so that they weren't embedded inside one another.
My website now uses a master aspx page which draws in different ascx controls. This means that I do not have the option of arranging the form tags around the page so need a work around.
NB. I have looked all over the place for simple solutions but it is a jungle out there, paypal is a nightmare. I did find something on ghost form which is all in c#. Might help...
Thanks in advance for any help....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用他们的 API 提交 PayPal 信息,而不是直接向他们提交表单。
这样您就可以将所有内容保留为单个表单的一部分,并在 PayPal 输入和验证方面添加更多的稳健性。
PayPal:SDK 和下载
Submit the PayPal information using their APIs rather than submitting a form directly to them.
That way you can keep everything as part of a single form and add a little more robustness around the PayPal input and validation.
PayPal: SDKs and Downloads
另一个支付提供商也有这个问题。您可以使用他们的 API,也可以通过以下方式解决此问题:
即
ClientScript.RegisterStartupScript(Me.GetType(), "PaypalSubmit", "", False)
希望这有帮助,否则您可以使用 Web 服务 API。通过采用这种方法,您将执行回发,输出 HTML 表单(在 .NET 表单之外,因为它位于页面底部),然后依靠 javascript 实际提交它。
Had this issue with another payment provider also. You could either use their API, or you could work around it by:
i.e.
ClientScript.RegisterStartupScript(Me.GetType(), "PaypalSubmit", "<AllMarkUp><GoesHere><script>And.Javascript</script>", False)
Hope this helps, otherwise you could use the web service API. By taking this approach you are performing a postback, outputting the HTML form (outside the .NET form because it is at the bottom of the page) and then relying on the javascript to actually submit it.
这是对你有用的东西。在您的代码隐藏中:
创建一个覆盖 HtmlForm 类的自定义表单类:
Here's something that will work for you. In your code-behind:
Create a custom form class which overrides the HtmlForm class: