I have an asp.net page which I need to get parameters from an HTML template . I'm trying the way below but I can not get the values. Here is my code:
HTML - Template
<form method="post" action="http://localhost:61712/Default.aspx">
<TABLE>
<TBODY>
<TR>
<tdTEXT-ALIGN: center">
<p><font size="3"><b>Solicitacao Nr. %NUMSC% </b></font>
<input type="hidden" name="NumeroSC" value="%NUMSC%" />
</td>
</tr>
</tbody>
</table>
</form>
My ASP.NET page Default.aspx
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
protected void Page_Load(Object Src, EventArgs E)
{
string host = "******";
string usuario = "******";
string senha = "******";
string banco = "******";
var Compra = Request.Form["NumeroSC"];
string strSQL = "SELECT codigo as Numero, arquivo from MeuDatabase where codigo like '%Compra%'"; // é dessa forma que pego o parametro na string? Já tentei também + Compra +
SqlConnection conexao = new SqlConnection("Data Source=" + host + ";DATABASE=" + banco + ";UID=" + usuario + "; PWD=" + senha + ";");
conexao.Open();
...
When running my ASP.NET page, the page returns no value for the query. I have already tried in HTML in value
pass an existing fixed value but also in my query does not return value.
What am I doing wrong? How can I get this parameter %NUMSC%
correctly?
EDIT
This form is not a submit, it's a template. Each new request is assembled and filed one html, one for each request. My desire is that with every html I open I call the asp.net page with the information for that specific file number. It works like this: an approving user receives an email with the link pointing to the html (invoice). I wanted it when the user opened the link he would see the data he already sees more a "frame" embedded in that html that is a href pointing to the attachment (document) referring to that invoice. The point is that I can not edit the code of the program that generates the invoice to already bring this information. So I saw the need to create an ASP.NET page.