I have a simple aspx page that reads Infopath XML from a database and sends it to the client. Works fine, but I notice using Fiddler that Infopath then calls the same aspx page 5 or 6 times for the same data. Any idea why it would do this? Here's the sample code:
protected void Page_Load(object sender, EventArgs e)
{
DataSet documentDataSet = new DataSet(); using (SqlConnection conn = new SqlConnection("server=rcs2dbdev;database=rcs2;user id=xxx;password=xxx;"))
{
conn.Open();
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText =
"select Name, InfoPathDoc as InfopathFormXML from Document where ID = 123"; SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(cmd);
sqlDataAdapter.Fill(documentDataSet);
}
XDocument xDoc = XDocument.Parse(documentDataSet.Tables[0].Rows[0]["InfopathFormXML"].ToString());
Response.AppendHeader(
"Content-disposition", "attachment; filename=" + documentDataSet.Tables[0].Rows[0]["Name"]); Response.ContentType = "application/ms-infopath.xml";
Response.Write(xDoc);
Response.Flush();
Response.End();
}