簡體   English   中英

一個頁面只能有一個服務器端 Form 標簽。 錯誤

[英]A page can have only one server-side Form tag. error

在此處輸入圖片說明

<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="ESign_License.aspx.cs" Inherits="ESign_License" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>       
</head>
<body>
<form id="license" runat="server">       
        <asp:Image ID="logo" runat="server" ImageAlign="Middle" Width="100px" Height="100px" CssClass="img" /><br />       
    <table style="width: 100%; height: 800px">
        <tr>                
            <td colspan="2" align="center">
                <asp:Image ID="logo" Width="100px" Height="100px" runat="server" ImageUrl="~/Image/kar_logo4.jpg" ImageAlign="Middle" />
            </td>

        </tr>
        <tr style="height:10px!important;">
            <%-- <td class="auto-style2"></td>--%>
            <td colspan="2" align="center">
                <span style="font-size: 25px">License</span>
            </td>
        </tr>
        <tr style="height:10px!important;">
            <td class="auto-style2"></td>
            <td style="border: 0px; margin: auto;  width: 40%; text-align: left">
                <br />

                  Registration No -
                        <asp:Label ID="Reg_no" runat="server"></asp:Label>
                <br />
                License No -
                        <asp:Label ID="lbllice_no" runat="server"></asp:Label><br />
                Valid From -
                        <asp:Label ID="isueDate" runat="server"></asp:Label><br />
                Valid upto -
                        <asp:Label ID="validDate" runat="server"></asp:Label>

            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <b>FORM 'A2' </b>
                <br />
                ACKNOWLEDGEMENT<br />
                (<asp:Label ID="License_type" runat="server" Text="Label"></asp:Label>
                )<br />
                [See Clause 8 (3)]<br />
            </td>
        </tr>
    </table>
    <br />
    <div class="row">
        <div class="col-md-12">
            <table class="table">
                <tr>
                    <td colspan="2" style="padding-top: 0px; height: 30%">
                        <p>
                            Received from
                                           <asp:Label ID="lblmrs" runat="server"></asp:Label>
                            &nbsp;<asp:Label ID="lblname" runat="server"></asp:Label>
                            ,
                                        <asp:Label ID="lblpname" runat="server" Text="Label"></asp:Label>
                            , a complete Memorandum of Intimation along with Form O, fee of Rs.
                                                <asp:Label ID="lblfee" runat="server"></asp:Label>
                            /- bearing SBI(Govt.),
                                                <asp:Label ID="lblbranch" runat="server"></asp:Label>
                            , Dated
                                                <asp:Label ID="lblpaiddate" runat="server"></asp:Label>
                            .
                                                <br />
                        </p>
                        <br />
                        <p>This acknowledgement shall be deemed to be the letter of authorization entitling the applicant to carry on the business as applied for, for a period of 5 years from the date of issue of this Memo of acknowledgement unless suspended or revoked by the competent authority.</p>
                        <br />
                        <p>

                                        <asp:Label ID="lblrespon" runat="server"></asp:Label>
                            ,
                                            <asp:Label ID="lblradres" runat="server"></asp:Label>
                            , Email-id:
                                                <asp:Label ID="lblemail" runat="server"></asp:Label>
                            , Mob. No:
                                                <asp:Label ID="lblmob" runat="server"></asp:Label>
                            &nbsp;is the responsible officer as per clause 24 of FCO, 1985.
                        </p>
                        <br />
                        <br />
                        *Enclosed details of Fertilizers in Annexure.
                    </td>
                </tr>

            </table>
     </form>
  </body>
  </html>

   protected void export_click(object sender, EventArgs e)
    {
        using (StringWriter sw = new StringWriter())
        {
            using (HtmlTextWriter hw = new HtmlTextWriter(sw))
            {
                string strid = Utilities.Decrypt(Request.QueryString["lbid1122"].ToString().Trim().Replace(" ", "+"), ConfigurationManager.AppSettings["AadharEncKey"]);
                string appPath = HttpContext.Current.Request.ApplicationPath;
                logo.ImageUrl = Server.MapPath(".") + "\\Image\\kar_logo4.jpg";                   
                string path = Server.MapPath(appPath + "eSign/eSignfiles/" + strid + ".pdf");
                this.Page.RenderControl(hw);
                dynamic output = new FileStream(path, FileMode.Create);
                StringReader sr = new StringReader(sw.ToString());
                Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
                PdfWriter writer = PdfWriter.GetInstance(pdfDoc, output);
                pdfDoc.Open();                  
                XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, sr);                   
                pdfDoc.Close();
                Response.ContentType = "application/pdf";
                Response.AddHeader("content-disposition", "attachment;filename=" + strid + ".pdf");
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
             }
        }
    }

頁面僅顯示一個服務器端表單標簽錯誤,盡管我只有一個表單標簽,但我也沒有使用任何母版頁。 請幫助我這可能是什么問題。 我已經發布了頁面的完整代碼,請查看這個我沒有在代碼中的任何地方使用過表單標簽。

一件事是它在本地完全正常,但是當推送到服務器時,我們收到此錯誤

我正在使用 XMLWorkerHelper 生成 PDF 是因為這個錯誤嗎??

更新頁面加載代碼

protected void Page_Load(object sender, EventArgs e)
    {       
            pageName = Path.GetFileName(Request.Path);
            uid = Session["UserID"] != null ? Convert.ToString(Session["UserID"].ToString().Trim()) : "";
        if (IsPostBack == false)
        {
            if ((Session["RoleCode"].ToString() == "11") || (Session["RoleCode"].ToString() == "2") || (Session["RoleCode"].ToString() == "5") || (Session["RoleCode"].ToString() == "8") || (Session["RoleCode"].ToString() == "4"))
            {
                uploading();
                gridstoragebind();
                export_click(this, null);
            }
            else
            {
                Session.Clear();
                Response.Redirect("~/Login.aspx");
            }
        }

更新上傳()方法

 private void uploading()
   {
    try
    {
        if (con.State == ConnectionState.Closed)
            con.Open();
        string strid = Utilities.Decrypt(Request.QueryString["lbid1122"].ToString().Trim().Replace(" ", "+"), ConfigurationManager.AppSettings["AadharEncKey"]);            

        string query = "select LI.RegNo,af.App_Name,af.Photo,d.DName,t.TName,ur.Gender,af.Sales_Adress,dt.Dealer_Region,LI.License_No,LI.Responsible_person,LI.Generated_Date,LI.Respo_Adres,LI.Respo_adhar,LI.Respo_email,LI.Respo_Mob, convert(varchar(100),LI.Issue_Date,103) Issue_Date,convert(varchar(100),LI.Valid_Date,103) Valid_Date,d.DName,t.TName,LI.Approved_by,FP.AmountPaid,FP.BranchName,convert(varchar(100),FP.PaidDate,103) as PaidDate from FL_License_issued as LI " +
                        "join FL_Form_A1 as af on af.Reg_No=LI.RegNo " +
                        "join User_Registration as ur on af.user_id = ur.user_id " +
                        "join FL_mst_Applying_category as dt on LI.Dealer_Type=dt.Dealer_Code " +
                        "left join FeePayment as FP on LI.RegNo=FP.RegNo " +
                        "left join District as d on LI.ADistrict=d.DCode " +
                        "left join Taluk as t on LI.ADistrict=t.DCode and LI.ATaluk=t.TCode " +
                        "where LI.RegNo='" + strid + "'";

        SqlDataAdapter ad = new SqlDataAdapter(query, con);
        DataTable dt = new DataTable();
        ad.Fill(dt);

        if (dt.Rows.Count > 0)
        {
            Reg_no.Text = dt.Rows[0]["RegNo"].ToString().Trim();
            lbllice_no.Text = dt.Rows[0]["License_No"].ToString().Trim();
            isueDate.Text = dt.Rows[0]["Issue_Date"].ToString().Trim();
            validDate.Text = dt.Rows[0]["Valid_Date"].ToString().Trim();
            License_type.Text = dt.Rows[0]["Dealer_Region"].ToString().Trim();

            lblfee.Text = dt.Rows[0]["AmountPaid"].ToString().Trim();
            lblbranch.Text = dt.Rows[0]["BranchName"].ToString().Trim();
            lblpaiddate.Text = dt.Rows[0]["PaidDate"].ToString().Trim();
            Session["approved_by"] = dt.Rows[0]["Approved_by"].ToString().Trim();

            if (dt.Rows[0]["Photo"].ToString().Trim() != null || dt.Rows[0]["Photo"].ToString().Trim() != "")
            {
                Session["Photo"] = (byte[])dt.Rows[0]["Photo"];
                string encrypt_id = Utilities.encrypt(Utilities.convt("3"), ConfigurationManager.AppSettings["AadharEncKey"]);
                // img_dealer.ImageUrl = "Image.aspx?id=" + encrypt_id + "";
                Session["ImageUrl"] = "Image.aspx?id=" + encrypt_id + "";
            }
            else
            {
                // img_dealer.ImageUrl = null;
            }


            if (dt.Rows[0]["Approved_by"].ToString().Trim() == "8")
            {
                lbl_seal.Text = "Assistant Director of Agriculture";
                lbltplace.Text = dt.Rows[0]["TName"].ToString().Trim();
                lbldplace.Text = dt.Rows[0]["DName"].ToString().Trim();
            }
            else
            {
                lbl_seal.Text = "Joint Director of Agriculture";
                //lbldplace.Text = dt.Rows[0]["DName"].ToString().Trim();
            }

            DateTime today = DateTime.Today;
            lblname.Text = dt.Rows[0]["App_Name"].ToString().Trim();
            lblpname.Text = dt.Rows[0]["Sales_Adress"].ToString().Trim();
            lblrespon.Text = dt.Rows[0]["Responsible_person"].ToString().Trim();
            lblradres.Text = dt.Rows[0]["Respo_Adres"].ToString().Trim();
            ////lblrespoaadar.Text = dt.Rows[0]["Respo_adhar"].ToString().Trim();
            lblemail.Text = dt.Rows[0]["Respo_email"].ToString().Trim();
            lblmob.Text = dt.Rows[0]["Respo_Mob"].ToString().Trim();
            lblgeneDate.Text = dt.Rows[0]["Generated_Date"].ToString().Trim();


        }

    }

當頁面嵌入母版頁並且該頁面還具有表單標記時,通常會發生這種情況。 這很難說,因為我對項目結構一無所知。 但這里有一些提示。 既然您說您沒有附加任何母版頁,請檢查該頁面是否設置為附加到任何 _Layout.aspx 或任何其他布局頁面。 在 MVC 中,當您創建頁面時,可以選擇在布局頁面中添加您的頁面。

作為一種解決方法,我建議您從頁面中刪除現有的表單標簽並查看頁面是如何呈現的。

暫無
暫無

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

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