【问题标题】:Paypal Form Tag issue in asp.netasp.net 中的 Paypal 表单标签问题
【发布时间】:2013-10-06 02:08:35
【问题描述】:

大家好,我在加载 asp.net 时遇到问题

我在子页面使用母版页在母版页中有一个表单标签我在子页中添加了一个贝宝按钮,这在母版页表单标签中也很重要

在母版页<form id="form1" runat="server"></form>

并且在 sup 年龄

 <form id="form2" runat="server" name="Paypal" action="https://www.paypal.com/cgi-bin
          /webscr"
              method="post">
              <input type="hidden" name="cmd" value="_cart" />
              <input type="hidden" name="upload" value="1" />
              <input type="hidden" name="business" value="
   <%=System.Web.Configuration.WebConfigurationManager.AppSettings["email"] %>
    " />
  <input type="hidden" name="item_name_1" value="<%=Session["ItemName"].ToString()%>" 
       />
  <input type="hidden" name="amount_1" value="<%=Session["ItemCost"].ToString() %>"/>
  <input type="hidden" name="quantity_1" value="1" />
  <input type="hidden" name="currency_code" value="USD" />
  <input type="hidden" name="return" value="<%=Session["returnUrl"].ToString() %>"/>
  <input type="hidden" name="lc" value="Stronger" />
  <input type="image" src="images/paynow.png" border="0" name="submit" alt="Make
         payments with PayPal - it's fast, free and secure!"
           style="background: url(images/update-account.png);"/>
</form>

我在下面的子页面中遇到了这个问题

“/Project”应用程序中的服务器错误。 一个页面只能有一个服务器端 Form 标签。 说明:当前web执行过程中发生了未处理的异常 要求。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详情:System.Web.HttpException:一个页面只能有一个服务器端Form标签。

任何人都知道如何在子页面中使用表单标签。

【问题讨论】:

    标签: asp.net c#-4.0 button paypal


    【解决方案1】:

    请检查您的 aspx/html 页面上写了多少 &lt;form&gt; 标签。确保您没有为此页面使用母版页。

    【讨论】:

    • 我找到了一个解决方案,现在它工作得很好,我将添加一个可能的问题,希望对你也有帮助。
    【解决方案2】:

    您好,我找到了这个解决方案,其工作解决方案如下:

    <form name="Paypal" action="https://www.paypal.com/cgi-bin/webscr"
                                    method="post" target="_blank"></form>
                                    <form name="Paypal" action="https://www.paypal.com/cgi-bin/webscr"
                                    method="post">
                  <input type="hidden" name="cmd" value="_cart" />
                  <input type="hidden" name="upload" value="1" />
                  <input type="hidden" name="business" value="
       <%=System.Web.Configuration.WebConfigurationManager.AppSettings["email"] %>
        " />
      <input type="hidden" name="item_name_1" value="<%=Session["ItemName"].ToString()%>" 
           />
      <input type="hidden" name="amount_1" value="<%=Session["ItemCost"].ToString() %>"/>
      <input type="hidden" name="quantity_1" value="1" />
      <input type="hidden" name="currency_code" value="USD" />
      <input type="hidden" name="return" value="<%=Session["returnUrl"].ToString() %>"/>
      <input type="hidden" name="lc" value="Stronger" />
      <input type="image" src="images/paynow.png" border="0" name="submit" alt="Make
             payments with PayPal - it's fast, free and secure!"
               style="background: url(images/update-account.png);"/>
    </form>
    

    这段代码运行良好。

    【讨论】:

      【解决方案3】:

      如果您在 MasterPage 下不要使用表单标签只要您在表单中,只需将其删除,删除导致提交的隐藏输入,然后使用以下 ImageButton:

      <asp:ImageButton ID="cmdpay" runat="server" PostBackUrl="https://www.paypal.com/cgi-bin/webscr" Text=""  ImageUrl="images/paynow.png" ></asp:ImageButton>
      

      有效

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-07-30
        • 2012-01-10
        • 2018-08-04
        • 2019-06-05
        • 2014-11-19
        • 2011-10-12
        相关资源
        最近更新 更多