Call ASP.NET application via HTML page

5

I have an application that I can not change the source code that generates purchase orders. For each request an html with the request data is stored. I want to implement this html with the following: When opening the html, embed a simple page in asp.net that will bring information and a link corresponding to the number of that request.

The currently generated HTML template is as follows:

<TABLE width="100%" bordercolorlight="#000000" border="1">
 <TBODY>
   <TR>
      <!--TD style="WIDTH: 112px">
          <P align=left><img border="0" src=!wf_link!images/logo.jpg></P>
      </TD-->
      <td style="text-align: left; vertical-align: middle; width: 18%;">
          <img style="width:auto; text-align:center; vertical-align:middle; height:auto;" src=!wf_link!images/logo.jpg>
      </td>

      <td style="WIDTH: 866px; TEXT-ALIGN: center">
          <p><font size="3"><b>SOLICITAÇÃO DE COMPRAS Nr. %NUMSC% (Filial %FILIAL%)</b></font> // campo que preciso obter na minha consulta ao banco
      </td>

      <td style="WIDTH: 300px">
          <dl>
              <div align="left">
                  <dt><font><b>Cód. Aprov.:</b></font>
                      <FONT color=#000000 face="Verdana">
                          <SPAN class=style7 style="font-weight: 400">%CAMPO2%</span>
                      </FONT>
                  </dt>
                  <dd>
                  <dt><b><font align="left">Nome:</font></b>
                      <FONT color=#000000 face="Verdana">
                          <SPAN class=style7 style="font-weight: 400">%CAMPO3%</span>
                      </FONT>
                  </dt>
              </div>
          </dl>
      </td>

  </TR>

The ASP.NET page I want to embed in the code:

<script runat="server">
        protected void Page_Load(Object Src, EventArgs E)
        {

            string host = "****";
            string usuario = "****";
            string senha = "****";
            string banco = "****"; 


  string strSQL = "SELECT codigo, arquivolink from MinhaTabela"; // Aqui eu preciso dar um where pegando o campo %NUMSC% do HTML

            SqlConnection conexao = new SqlConnection("Data Source=" + host + ";DATABASE=" + banco + ";UID=" + usuario + "; PWD=" + senha + ";");

                conexao.Open();

                    SqlCommand comando = new SqlCommand(strSQL, conexao);
                    SqlDataReader dr = comando.ExecuteReader();

                        Response.Write("<table border='1'>");

                            for (int i = 0; i < dr.FieldCount; i++)
                            {
                                Response.Write("<th>" + dr.GetName(i) + "</th>");
                            }

                            while (dr.Read())
                            {
                                Response.Write("<tr>");
                                    for (int i = 0; i < dr.FieldCount; i++)
                                    {
                                        Response.Write("<td align='center'>" + dr.GetValue(i) + "</td>");
                                    }
                                Response.Write("</tr>");
                            }
                        Response.Write("</table>");

                    dr.Close();
                    dr.Dispose();
                    comando.Dispose(); 

                conexao.Close();
                conexao.Dispose();

        }
    </script>

What I need is that when opening the HTML page I visualize below everything, the information coming from these script that would be the number and the file referring to the number of that invoice. Since this file name will be a link to open an attachment (pdf, txt, etc) that will be in a folder on my application server.

Do I need to have this page / application different? How do I get a certain html field in my bank query?

    
asked by anonymous 18.06.2015 / 16:51

1 answer

1

Format your URL to pass the fields to the source:

 < form method="post" action="http:/ / servidor/aplicativo/Pagina.aspx">
<TABLE width="100%" bordercolorlight="#000000" border="1">
<TBODY>
<TR>
  <!--TD style="WIDTH: 112px">
      <P align=left><img border="0" src=!wf_link!images/logo.jpg></P>
  </TD-->
  <td style="text-align: left; vertical-align: middle; width: 18%;">
      <img style="width:auto; text-align:center; vertical-align:middle; height:auto;" src=!wf_link!images/logo.jpg>
  </td>

  <td style="WIDTH: 866px; TEXT-ALIGN: center">
      <p><font size="3"><b>SOLICITAÇÃO DE COMPRAS Nr. %NUMSC% (Filial %FILIAL%)</b></font> // campo que preciso obter na minha consulta ao banco
          <input type="hidden" name="NumeroCompra" value="%NUMSC%" />
          <input type="hidden" name="Filial" value="%FILIAL%" />
  </td>

  <td style="WIDTH: 300px">
      <dl>
          <div align="left">
              <dt><font><b>Cód. Aprov.:</b></font>
                  <FONT color=#000000 face="Verdana">
                      <SPAN class=style7 style="font-weight: 400">%CAMPO2%</span>
                      <input type="hidden" name="CodAprov" value="%CAMPO2%" />
                  </FONT>
              </dt>
              <dd>
              <dt><b><font align="left">Nome:</font></b>
                  <FONT color=#000000 face="Verdana">
                      <SPAN class=style7 style="font-weight: 400">%CAMPO3%</span>
                      <input type="hidden" name="Nome" value="%CAMPO3%" />
                  </FONT>
              </dt>
          </div>
      </dl>
  </td>

  </TR>
 <  /  TABLE >
 < / form>

And in Your Forml_Load capture this field

var Compra = Request.Form["NumeroCompra"];
var Filial = Request.Form["Filial"];
    
18.06.2015 / 20:22